libsdl-org / sdl12-compat

An SDL-1.2 compatibility layer that uses SDL 2.0 behind the scenes.
Other
193 stars 40 forks source link

pachi: Crash on startup #257

Closed smcv closed 1 year ago

smcv commented 1 year ago

Prerequisites:

To reproduce:

Expected result: it runs

Actual result: real SDL 1.2 works. sdl12-compat segfaults on startup with a very unhelpful stack trace (it seems debuginfod.debian.net doesn't have access to its debug symbols):

#0  0x00007fcbda72b25f in  ()
#1  0x00007ffc71daafa8 in  ()
#2  0x00007fcbda72b31f in  ()
#3  0x00007fcbda7273d0 in  ()
#4  0x0000000000000000 in  ()
smcv commented 1 year ago

I'm going to continue testing other games rather than focusing on this one, but let me know if you'd like me to do a rebuild with debug symbols so we can get a useful stack trace.

icculus commented 1 year ago

but let me know if you'd like me to do a rebuild with debug symbols so we can get a useful stack trace.

I did it (I'm probably going to need it locally anyhow, and "apt-get source pachi" makes this easy enough.)

Thread 1 "pachi" received signal SIGSEGV, Segmentation fault.
0x000055555555c04c in init_intro () at /home/icculus/pachi-1.0/src/intro.c:33
33      SDL_FillRect(temp, NULL, SDL_MapRGB(temp->format,0,0,0));
(gdb) bt
#0  0x000055555555c04c in init_intro() () at /home/icculus/pachi-1.0/src/intro.c:33
#1  0x000055555555c13b in intro() () at /home/icculus/pachi-1.0/src/intro.c:51
#2  0x00005555555634b6 in main(int, char**) (argc=1, argv=0x7fffffffe008) at faes.cpp:66
icculus commented 1 year ago

temp is NULL here, hence the crash in the game and not sdl12-compat.

Created on the line before:

temp=SDL_CreateRGBSurface(SDL_SWSURFACE, screen_w, screen_h, screen_bpp, 255, 255, 255, 0);

screen_w, screen_h and screen_bpp are 800, 600, and 16, respectively.

icculus commented 1 year ago

I guess the bogus masks are what causes this. This is a different angle on the same thing rockdodger does: a bogus surface that they immediately convert with SDL_DisplaySurface.

smcv commented 1 year ago

Confirmed fixed by https://github.com/libsdl-org/sdl12-compat/commit/67f8b3a85b782eefb4db90f34d5b0742ef2cb5fc, 1.2.58 + 29 commits