more on bm_load_animation bug

Taylor Richards trichard at surfsouth.com
Sat Oct 5 15:37:05 EDT 2002


Ok, I've checked and rechecked all files that are loaded and the
filenames are all null terminated.  I set a breakpoint in bmpman.cpp in
bm_load_animation to catch every file going through.  The last
successful file loaded looks like this: 

Breakpoint 4, bm_load_animation(char*, int*, int*, int)
(real_filename=0x88bafcc "exp05", nframes=0xbffff6d0, fps=0xbffff6d4,
can_drop_frames=1) at src/bmpman/bmpman.cpp:1166 

And that processes fine though it yields this: 

(gdb) print filename 
$43 = "exp05.ani\0ani\0\006B8\020?\b\0\0\0\08\020?\b\001\0\0" 

The big problem is the next load which looks like this: 

Breakpoint 4, bm_load_animation(char*, int*, int*, int) ( 
    real_filename=0x88bb080 "\200\\\211\b\\_\211\b8b\211\b\024e 
\211\b?g\211\b?j\211\b?m\211\b\204p\211\b`s\211\b<v\211\b\030y\211 
\b?{\211\b?~\211\b?\201\211\b\210\204\211\bd\207\211\b@\212\211\b 
\034\215\211\b?\217\211\b?\222\211\b?\225\211\b\214\230\211\bh\233 
\211\bD\236\211\b?\211\b??\211\bئ\211\b??\211\b\220?\211\bl?\211 
\bH?\211\b$?\211\b", nframes=0xbffff6d0, fps=0xbffff6d4, 
    can_drop_frames=1) at src/bmpman/bmpman.cpp:1166 

(lines wrapped by me) After that all hell breaks loose and it tries to
load all sorts of random info, some actually files or rather
parts/contents of files from the vp.  After that SIGSEGV.  This happens
in the full FS1 when at the loading screen going into a mission brief. 
This does not happen with the FS1 demo.  Attached is a backtrace.  If
you step through bm_load_animation it of course goes to cfile and runs
through looking for the file in question.  I thought this might be a
problem and extracted all files from the vps in order to load files off
the disk instead of a vp but I get the same thing.  If the problem is in
cfile I haven't located it yet.  Don't know where to go from here.


Taylor


P.S.  On a side note I think I've fixed the popup crash.  In
src/popup/popup.cpp in popup_init() where it creates invisible buttons
to detect mouse clicks there is an "if else" which seems to be where the
problem is.  If I allow just one to the two choices there is no crash. 
I put in an ifdef to only use the second one (the else) which seems to
handle the popup buttons correctly but I haven't testing all of the
popups yet to verify that a single affirmative (can't remember where
this popup happens) will work as expected.  I don't understand why this
fixes it though.
-------------- next part --------------
#0  0x08063526 in cf_create_default_path_string(char*, int, char*, bool) (
    path=0xbfffee50 "/home/tazman/tmp/freespace/", pathtype=2080906499,
    filename=0xbfffefb0 "\b &\b?\037&\bZ\001\035\b\024 &\b?\037&\b~\001\035\b  &\b?\037&\b?\001\035\b, &\b?\037&\b?\001\035\b5 &\b?\037&\b?\002\035\bD &\b?\037&\b?\002\035\bU &\b?\037&\b\f\003\035\bd &\b?\037&\bH\003\035\bp &\b?\037&\bz\003\035\b| &\b?\037&\b?\003\035\b\205 &\b?\037&\b\002\004\035\b\215 &\b?\037&\b\"\004\035\b\227 &\b?\037&\b?\004\035\b? &\b?\037&\b?\004\035\b? &\b?\037&\b.ani", localize=false) at src/cfile/cfilesystem.cpp:1385
#1  0x080627b5 in cf_find_file_location(char*, int, char*, int*, int*, bool) (
    filespec=0xbfffefb0 "\b &\b?\037&\bZ\001\035\b\024 &\b?\037&\b~\001\035\b  &\b?\037&\b?\001\035\b, &\b?\037&\b?\001\035\b5 &\b?\037&\b?\002\035\bD &\b?\037&\b?\002\035\bU &\b?\037&\b\f\003\035\bd &\b?\037&\bH\003\035\bp &\b?\037&\bz\003\035\b| &\b?\037&\b?\003\035\b\205 &\b?\037&\b\002\004\035\b\215 &\b?\037&\b\"\004\035\b\227 &\b?\037&\b?\004\035\b? &\b?\037&\b?\004\035\b? &\b?\037&\b.ani", pathtype=-1,
    pack_filename=0xbffff040 "\227 &\b?\037&\b?\004\035\b? &\b?\037&\b?\004\035\b? &\b?\037&\b.ani", size=0xbffff038, offset=0xbffff03c, localize=false) at src/cfile/cfilesystem.cpp:879
#2  0x08060437 in cfopen(char*, char*, int, int, bool) (
    file_path=0xbffff190 "\b &\b?\037&\bZ\001\035\b\024 &\b?\037&\b~\001\035\b  &\b?\037&\b?\001\035\b, &\b?\037&\b?\001\035\b5 &\b?\037&\b?\002\035\bD &\b?\037&\b?\002\035\bU &\b?\037&\b\f\003\035\bd &\b?\037&\bH\003\035\bp &\b?\037&\bz\003\035\b| &\b?\037&\b?\003\035\b\205 &\b?\037&\b\002\004\035\b\215 &\b?\037&\b\"\004\035\b\227 &\b?\037&\b?\004\035\b? &\b?\037&\b?\004\035\b? &\b?\037&\b.ani", mode=0x8247860 "rb", type=0, dir_type=-1, localize=false)
    at src/cfile/cfile.cpp:856
#3  0x0805d00d in bm_load_animation(char*, int*, int*, int) (
    real_filename=0x88bd5ec "\b &\b?\037&\bZ\001\035\b\024 &\b?\037&\b~\001\035\b  &\b?\037&\b?\001\035\b, &\b?\037&\b?\001\035\b5 &\b?\037&\b?\002\035\bD &\b?\037&\b?\002\035\bU &\b?\037&\b\f\003\035\bd &\b?\037&\bH\003\035\bp &\b?\037&\bz\003\035\b| &\b?\037&\b?\003\035\b\205 &\b?\037&\b\002\004\035\b\215 &\b?\037&\b\"\004\035\b\227 &\b?\037&\b?\004\035\b? &\b?\037&\b?\004\035\b? &\b?\037&\b.\005\035\b", nframes=0xbffff6d0, fps=0xbffff6d4, can_drop_frames=1)
    at src/bmpman/bmpman.cpp:1171
#4  0x081cc99e in weapons_page_in() () at src/weapon/weapons.cpp:3418
#5  0x0805451b in level_page_in() () at src/freespace2/levelpaging.cpp:94
#6  0x0804c6b9 in freespace_mission_load_stuff() () at src/freespace2/freespace.cpp:2032
#7  0x0804c844 in game_start_mission() () at src/freespace2/freespace.cpp:2105
#8  0x08051fc9 in game_enter_state(int, int) (old_state=1, new_state=44)
    at src/freespace2/freespace.cpp:6097
#9  0x08075815 in gameseq_set_state(int, int) (new_state=44, override=0)
    at src/gamesequence/gamesequence.cpp:497
#10 0x080510ec in game_process_event(int, int) (current_state=1, event=1)
    at src/freespace2/freespace.cpp:5224
#11 0x08075b43 in gameseq_process_events() () at src/gamesequence/gamesequence.cpp:610
#12 0x080533ad in WinMainSub(int, int, char*, int) (hInst=1, hPrev=0, szCmdLine=0x89778c8 "",
    nCmdShow=0) at src/freespace2/freespace.cpp:7146
#13 0x080533e0 in WinMain(int, int, char*, int) (hInst=1, hPrev=0, szCmdLine=0x89778c8 "",
    nCmdShow=0) at src/freespace2/freespace.cpp:7184
#14 0x080546fd in main (argc=1, argv=0xbffff8c4) at src/freespace2/unixmain.cpp:41
#15 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6


More information about the freespace2 mailing list