Issue580

Title Crash when Ewald's 296 bot teleports back to town
Priority critical Status resolved
Assigned To ahuillet Keywords
Linked issues Watchers

Submitted on 2012-04-14 16h08 by alexandros, last changed by ahuillet.

Files
File name Uploaded Type Edit Remove
a.patch ahuillet, 2012-04-18.19:37:29 text/x-patch
Messages
Author: alexandros Date: 2012-04-14   16h08
When exiting the "Three Fermis land" level, after the 296 tells you that it will
sacrifice itself, the game crashes under the following occasion:

1. Talk to the 296 until it tells you that it will sacrifice itself.
2. Save the game, exit FreedroidRPG and re-run it.
3. Continue your saved game and exit the "Three Fermis land" level WITHOUT
talking to the 296.
4. FreedroidRPG crashes.

FreedroidRPG will not crash, however, if you talk to the 296 before exiting the
level. In that case, a dialog window appears for just a blink of an eye.
Author: matthiaskrgr Date: 2012-04-14   20h15
When you run the game in the terminal, what is the crash-output?
Author: alexandros Date: 2012-04-16   16h34
Crash output when using the Sanctuary skill:

print_trace:  Obtained 21 stack frames.
print_trace:  Obtaining symbols now done.
freedroidRPG(print_trace+0x1e) [0x8089d1e]
[0xb85400]
freedroidRPG(autostr_append+0x1f) [0x80b6b8f]
freedroidRPG() [0x806f1ca]
freedroidRPG() [0x80d9ab5]
freedroidRPG() [0x80e24ca]
freedroidRPG() [0x80d9f48]
freedroidRPG() [0x80d70e1]
freedroidRPG() [0x80d95f7]
freedroidRPG() [0x80d9659]
freedroidRPG(lua_pcall+0x5b) [0x80d6f1b]
freedroidRPG(run_lua+0x4d) [0x80705fd]
freedroidRPG(event_level_changed+0x6a) [0x806aa8a]
freedroidRPG(Teleport+0x284) [0x8089474]
freedroidRPG(DoSkill+0x8b7) [0x80682f7]
freedroidRPG(HandleCurrentlyActivatedSkill+0xe1) [0x8069601]
freedroidRPG(move_tux+0x22d) [0x80867ed]
freedroidRPG(Game+0xe5) [0x80940b5]
freedroidRPG(main+0x144) [0x8094224]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x346e37]
freedroidRPG() [0x805c031]

print_trace():  received SIGSEGV!

Crash output when exiting the level the "normal" way:

print_trace:  Obtained 29 stack frames.
print_trace:  Obtaining symbols now done.
freedroidRPG(print_trace+0x1e) [0x8089d1e]
[0x8b7400]
freedroidRPG(autostr_append+0x1f) [0x80b6b8f]
freedroidRPG() [0x806f1ca]
freedroidRPG() [0x80d9ab5]
freedroidRPG() [0x80e24ca]
freedroidRPG() [0x80d9f48]
freedroidRPG() [0x80d70e1]
freedroidRPG() [0x80d95f7]
freedroidRPG() [0x80d9659]
freedroidRPG(lua_pcall+0x5b) [0x80d6f1b]
freedroidRPG(run_lua+0x4d) [0x80705fd]
freedroidRPG(event_level_changed+0x6a) [0x806aa8a]
freedroidRPG(Teleport+0x284) [0x8089474]
freedroidRPG() [0x807015d]
freedroidRPG() [0x80d9ab5]
freedroidRPG() [0x80e24ca]
freedroidRPG() [0x80d9f48]
freedroidRPG() [0x80d70e1]
freedroidRPG() [0x80d95f7]
freedroidRPG() [0x80d9659]
freedroidRPG(lua_pcall+0x5b) [0x80d6f1b]
freedroidRPG(run_lua+0x4d) [0x80705fd]
freedroidRPG(trigger_position_events+0xeb) [0x806abab]
freedroidRPG(move_tux+0x557) [0x8086b17]
freedroidRPG(Game+0xe5) [0x80940b5]
freedroidRPG(main+0x144) [0x8094224]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x21ee37]
freedroidRPG() [0x805c031]

print_trace():  received SIGSEGV!
Author: ahuillet Date: 2012-04-17   07h30
Can you please reproduce the crash under GDB, please? Then get us a full
readable backtrace using "bt full" command when you get to the crash. (You'll
have to run the game windowed, -w commandline option)
Author: alexandros Date: 2012-04-18   19h31
Backtrace when using the Sanctuary skill:

#0  0x080b6b5c in autostr_vappend ()
No symbol table info available.
#1  0x080b6b8f in autostr_append ()
No symbol table info available.
#2  0x0806f1ca in ?? ()
No symbol table info available.
#3  0x080d9ab5 in ?? ()
No symbol table info available.
#4  0x080e24ca in ?? ()
No symbol table info available.
#5  0x080d9f48 in ?? ()
No symbol table info available.
#6  0x080d70e1 in ?? ()
No symbol table info available.
#7  0x080d95f7 in ?? ()
No symbol table info available.
#8  0x080d9659 in ?? ()
No symbol table info available.
#9  0x080d6f1b in lua_pcall ()
No symbol table info available.
#10 0x080705fd in run_lua ()
No symbol table info available.
#11 0x0806aa8a in event_level_changed ()
No symbol table info available.
#12 0x08089474 in Teleport ()
No symbol table info available.
#13 0x080682f7 in DoSkill ()
No symbol table info available.
#14 0x08069601 in HandleCurrentlyActivatedSkill ()
No symbol table info available.
#15 0x080867ed in move_tux ()
No symbol table info available.
#16 0x080940b5 in Game ()
No symbol table info available.
#17 0x08094224 in main ()

Crash output when exiting the level the "normal" way:

#0  0x080b6b5c in autostr_vappend ()
No symbol table info available.
#1  0x080b6b8f in autostr_append ()
No symbol table info available.
#2  0x0806f1ca in ?? ()
No symbol table info available.
#3  0x080d9ab5 in ?? ()
No symbol table info available.
#4  0x080e24ca in ?? ()
No symbol table info available.
#5  0x080d9f48 in ?? ()
No symbol table info available.
#6  0x080d70e1 in ?? ()
No symbol table info available.
#7  0x080d95f7 in ?? ()
No symbol table info available.
#8  0x080d9659 in ?? ()
No symbol table info available.
#9  0x080d6f1b in lua_pcall ()
No symbol table info available.
#10 0x080705fd in run_lua ()
No symbol table info available.
#11 0x0806aa8a in event_level_changed ()
No symbol table info available.
#12 0x08089474 in Teleport ()
No symbol table info available.
#13 0x0807015d in ?? ()
No symbol table info available.
#14 0x080d9ab5 in ?? ()
No symbol table info available.
#15 0x080e24ca in ?? ()
No symbol table info available.
#16 0x080d9f48 in ?? ()
No symbol table info available.
#17 0x080d70e1 in ?? ()
No symbol table info available.
#18 0x080d95f7 in ?? ()
No symbol table info available.
#19 0x080d9659 in ?? ()
No symbol table info available.
#20 0x080d6f1b in lua_pcall ()
No symbol table info available.
#21 0x080705fd in run_lua ()
No symbol table info available.
#22 0x0806abab in trigger_position_events ()
No symbol table info available.
#23 0x08086b17 in move_tux ()
No symbol table info available.
#24 0x080940b5 in Game ()
No symbol table info available.
#25 0x08094224 in main ()
No symbol table info available.
Author: ahuillet Date: 2012-04-18   19h37
Would you please apply the attached patch and let us know if it fixes the crash?

Thanks!

Attached a.patch.
Author: joseph Date: 2012-04-20   11h02
The crash is caused by a NULL pointer. The chat log is initialized in the
run_chat function. Therefore, if you haven't chat with an NPC the chat_log won't
be initialized and chat_log.text will be NULL. The function chat_add_response
appends text to chat_log.text by calling autostr_append which doesn't check for
NULL pointers.

Moreover, cli_says shouldn't be used in events at all. The only place from which
cli_says should be called are dialogs. Arthur's patch is correct and it fixes
the crash.
Author: ahuillet Date: 2012-04-20   11h51
I see you've explained things better than I. Please commit the patch and close
the ticket. :)
Author: matthiaskrgr Date: 2012-04-26   13h41
Any news on patches here? :)
Author: ahuillet Date: 2012-04-29   10h13
Fixed in c6769940
History
Date User Action Args
2012-04-29 10:13:56ahuilletsetstatus: open -> resolved
assignedto: ahuillet
messages: + msg2237
2012-04-26 13:41:19matthiaskrgrsetmessages: + msg2226
2012-04-20 11:51:56ahuilletsetmessages: + msg2222
2012-04-20 11:02:16josephsetmessages: + msg2221
2012-04-18 19:37:30ahuilletsetpriority: bug -> critical
files: + a.patch
messages: + msg2218
2012-04-18 19:31:18alexandrossetmessages: + msg2217
2012-04-17 07:30:19ahuilletsetmessages: + msg2212
2012-04-16 16:34:45alexandrossetmessages: + msg2210
2012-04-14 20:15:32matthiaskrgrsetmessages: + msg2199
2012-04-14 16:08:55alexandroscreate