Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old April 5, 2014, 16:13   #1
Saplaran
Rookie
 
Join Date: Oct 2011
Location: Bavaria, Germany
Posts: 21
Saplaran is on a distinguished road
3.5.0 reproducible crash

I'm playing a kobold rogue in 3.5.0 (Windows 8.1 with Shockbolt's tiles and subwindows).

Unfortunately the game always crashes at a certain point. I have a savefile where you only need to walk two steps to the west. Since I don't know, if this is a known bug and looking for "game crashes when walking to the west" in bugtracking-lists seems somewhat pointless to me I just post a link to my savefile here. Maybe someone can help me...

http://www.mdiergardt.de/1000.Markus
Saplaran is offline   Reply With Quote
Old April 5, 2014, 16:53   #2
fizzix
Prophet
 
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,025
fizzix is on a distinguished road
Weird, I didn't get a crash on my clean 3.5 version (windows 7). What OS are you playing on?
fizzix is offline   Reply With Quote
Old April 5, 2014, 17:06   #3
Saplaran
Rookie
 
Join Date: Oct 2011
Location: Bavaria, Germany
Posts: 21
Saplaran is on a distinguished road
I'm using Windows 8.1...
Saplaran is offline   Reply With Quote
Old April 7, 2014, 16:03   #4
fizzix
Prophet
 
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,025
fizzix is on a distinguished road
Quote:
Originally Posted by Saplaran View Post
I'm using Windows 8.1...
I'm not sure we have any Windows 8 testers... The absence of comments in this thread seems to support this...

How many squares do you have to move to get a crash? Just one, or more. What happens if you go the other direction first and then backtrack? What about casting a spell?
fizzix is offline   Reply With Quote
Old April 7, 2014, 17:25   #5
Atanvarno
Rookie
 
Join Date: May 2009
Posts: 9
Atanvarno is on a distinguished road
I can reproduce this on Win7, but it requires that the monster list subwindow is just the right width so that the accented i in Ibun's name is barely visible (or would become barely visible when taking two steps to the west if it weren't for the crash).

I've had a similar problem in the past:
http://angband.oook.cz/forum/showthread.php?t=6618
Atanvarno is offline   Reply With Quote
Old April 7, 2014, 23:07   #6
MattB
Veteran
 
Join Date: Mar 2013
Location: Berkshire, UK
Posts: 1,214
MattB is on a distinguished road
Quote:
Originally Posted by Atanvarno View Post
I can reproduce this on Win7, but it requires that the monster list subwindow is just the right width so that the accented i in Ibun's name is barely visible (or would become barely visible when taking two steps to the west if it weren't for the crash).

I've had a similar problem in the past:
http://angband.oook.cz/forum/showthread.php?t=6618
That's just weird (to a non-coder), but an astonishing catch!
And as for win8, I just paid an extra £120 to get win7 for my new laptop...
MattB is offline   Reply With Quote
Old April 8, 2014, 02:12   #7
Dawnmist
Rookie
 
Join Date: Oct 2007
Posts: 23
Dawnmist is on a distinguished road
Quote:
Originally Posted by Atanvarno View Post
I can reproduce this on Win7, but it requires that the monster list subwindow is just the right width so that the accented i in Ibun's name is barely visible (or would become barely visible when taking two steps to the west if it weren't for the crash).

I've had a similar problem in the past:
http://angband.oook.cz/forum/showthread.php?t=6618
That would explain a consistent crash I was getting last December when identifying an artifact crown on the ground - I sent in the save file with the character standing on the unid'd crown, but while it was 100% consistent for me no-one else seemed to be able to reproduce it (was happening on win7). If I picked up the crown and id'd it, everything was fine (it would no longer have been in the objects subwindow then) - but identifying it before picking it up would crash. Can't remember which crown now, but I do remember it had an accent in the name because I was suspicious that the accent was part of why it was crashing.
Dawnmist is offline   Reply With Quote
Old April 8, 2014, 11:09   #8
Bogatyr
Knight
 
Join Date: Feb 2014
Posts: 523
Bogatyr is on a distinguished road
Quote:
Originally Posted by MattB View Post
That's just weird (to a non-coder), but an astonishing catch!
And as for win8, I just paid an extra £120 to get win7 for my new laptop...
Well worth it. windblow$ 8 is a disaster
Bogatyr is offline   Reply With Quote
Old April 8, 2014, 13:37   #9
fizzix
Prophet
 
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,025
fizzix is on a distinguished road
Quote:
Originally Posted by Atanvarno View Post
I can reproduce this on Win7, but it requires that the monster list subwindow is just the right width so that the accented i in Ibun's name is barely visible (or would become barely visible when taking two steps to the west if it weren't for the crash).

I've had a similar problem in the past:
http://angband.oook.cz/forum/showthread.php?t=6618
Very nice work
fizzix is offline   Reply With Quote
Old April 8, 2014, 14:01   #10
PowerWyrm
Prophet
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 2,972
PowerWyrm is on a distinguished road
Reproduced under Win7:
- move 2 squares left until Ibun gets in LOS
- reduce Term-1 width (monster list window) until the name becomes "[U] Ibun, Son of Mî (asleep) 2 S 6 W"
- game crashes

I compiled the source using my BC++5 environment and launched the exe in debug mode. Result is as follows: project angband.exe crashes with EAccessViolation at address 0051551B, reading address 11111119.

Here's the list of function calls at the moment of the crash:
- update_monlist_subwindow(EVENT_MONSTERLIST)
- monster_list_show_subwindow(16, 39)
- monster_list_format_textblock(list, textblock, 16, 39, ...)
- monster_list_format_section(list, textblock, MONSTER_LIST_SECTION_LOS, 1, 39, ...)
- textblock_append_c(tb, line_attr, "%-*s%s\n", full_width = 57, line_buffer = "[U] Ibun, Son of MÃ (asleep)", location = " 2 S 6 W") [line 419]
- textblock_vappend_c(tb, attr, fmt, vp)

At this point, a malloc-ed string temp_space is created from the va_args: temp_space = "[U] Ibun, Son of MÃ (asleep) 2 S 6 W\n".

Next call is Term_mbstowcs(NULL, temp_space, 0) to get the new length, but this call fails. The hook in Term_mbstowcs calls Term_mbstowcs_win from main-win.c: return (size_t)(MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, src, -1, NULL, 0) - 1);

Here the MultiByteToWideChar function fails (error code = 1113, ERROR_NO_UNICODE_TRANSLATION, "No mapping for the Unicode character exists in the target multi-byte code page") and returns 0. In this case, Term_mbstowcs returns -1, which is used as the new length. The following call tries to resize the textblock to an invalid size (-1 as a u32 value!) and fails with a crash...

Testing a little more in debug mode, it's easy to trace down the problem. Putting a breakpoint in update_monlist_subwindow, I was able to test the faulty code with term width = 40 then term width = 39. And here it is:

Code:
		/* Clip the monster name to fit, and append the sleep tag. */
		name_width = MIN(full_width - strlen(asleep), sizeof(line_buffer));
		get_mon_name(line_buffer, name_width + 1, list->entries[entry_index].race, list->entries[entry_index].count[section]);
		my_strcat(line_buffer, asleep, sizeof(line_buffer));
When term width = 40, everything works fine:
- name_width = 20
- line_buffer = "[U] Ibun, Son of Mî"

When term width = 39, the name is truncated!
- name_width = 19
- line_buffer = "[U] Ibun, Son of MÃ"

Then of course, the last character is not a valid unicode character anymore...

Fix: in get_mon_name(), ensure that the last character, if it's an unicode character, is not truncated.
__________________
PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!
PowerWyrm is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
V 3.5-dev crash eMeM Development 4 May 2, 2013 16:21
3.3.0 crash on startup Chud Vanilla 6 September 20, 2011 18:17
3.2.0 crash Londorth Vanilla 7 January 6, 2011 16:02
Crash Bug? Rizwan Vanilla 4 February 25, 2010 13:58
[FA] Crash Bug Zikke Variants 8 February 19, 2009 05:20


All times are GMT +1. The time now is 12:25.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.