Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schismtracker crashes when resizing window #183

Closed
ghost opened this issue May 1, 2022 · 3 comments
Closed

schismtracker crashes when resizing window #183

ghost opened this issue May 1, 2022 · 3 comments

Comments

@ghost
Copy link

ghost commented May 1, 2022

terminal output:

sdl_getwminfo?
double free or corruption (!prev)
Aborted (core dumped)

sometimes i also get this:
malloc(): invalid next size (unsorted)

bt:

#0  0x00007ffff7bc334c in __pthread_kill_implementation () from /usr/lib/libc.so.6
#1  0x00007ffff7b764b8 in raise () from /usr/lib/libc.so.6
#2  0x00007ffff7b60534 in abort () from /usr/lib/libc.so.6
#3  0x00007ffff7bb7397 in __libc_message () from /usr/lib/libc.so.6
#4  0x00007ffff7bcd33c in malloc_printerr () from /usr/lib/libc.so.6
#5  0x00007ffff7bd05fc in _int_malloc () from /usr/lib/libc.so.6
#6  0x00007ffff7bd2489 in calloc () from /usr/lib/libc.so.6
#7  0x00007ffff5ad2803 in ?? () from /usr/lib/dri/crocus_dri.so
#8  0x00007ffff5ad8d00 in ?? () from /usr/lib/dri/crocus_dri.so
#9  0x00007ffff4c8ce6e in ?? () from /usr/lib/dri/crocus_dri.so
#10 0x00007ffff4c406cf in ?? () from /usr/lib/dri/crocus_dri.so
#11 0x00007ffff4c4ba89 in ?? () from /usr/lib/dri/crocus_dri.so
#12 0x00007ffff4c4bb79 in ?? () from /usr/lib/dri/crocus_dri.so
#13 0x00007ffff7998d39 in ?? () from /usr/lib/libSDL2-2.0.so.0
#14 0x00007ffff798f940 in ?? () from /usr/lib/libSDL2-2.0.so.0
#15 0x00007ffff7f84db2 in SDL_UpdateRects () from /usr/lib/libSDL-1.2.so.0
#16 0x00007ffff7f84fa8 in SDL_UpdateRect () from /usr/lib/libSDL-1.2.so.0
#17 0x00007ffff7f85033 in SDL_Flip () from /usr/lib/libSDL-1.2.so.0
#18 0x0000555555560797 in ?? ()
#19 0xffffffff00000000 in ?? ()
#20 0x0000000000000000 in ?? ()


@sulix
Copy link
Contributor

sulix commented May 2, 2022

I can reproduce this here.

It looks to be a problem with the 24-bpp formats (on my system, the colours are inverted after the first resize). Not 100% sure if it's a bug in SchismTracker, a bug in sdl12-compat, or both. (My bet is on both: schismtracker overwrites the end of the surface in 24-bit mode even on real SDL1.2. The blue colour is probably the FIXME("bgr instead of rgb?"); we've had for ages.)

In the meantime, it seems to work with the SCHISM_VIDEO_DEPTH=32 environment variable set. Equally the YUV overlay version seems okay: schismtracker -v yuv.

sulix added a commit to sulix/schismtracker that referenced this issue May 2, 2022
SchismTracker will write 32-bits at a time to a 24-bit display when
scaling, which means it can overflow the end of the surface its writing
into. This usually isn't a problem: many implementations will be
tolerant of writing an extra byte or two past the end of the surface,
but sdl12-compat, for instance, isn't. See:
libsdl-org/sdl12-compat#183
sulix added a commit to sulix/sdl12-compat that referenced this issue May 2, 2022
We're currently using SDL_PIXELFORMAT_RGB24, which results in
schismtracker being blue when resized (libsdl-org#183).

While it's possible that RGB888 is wrong on big-endian systems, it at
least matches what we do for 16-bit (RGB565) and 32-bit (XRGB8888)
formats, so if we're wrong, we'll at least be consistently wrong.
slouken pushed a commit that referenced this issue May 2, 2022
We're currently using SDL_PIXELFORMAT_RGB24, which results in
schismtracker being blue when resized (#183).

While it's possible that RGB888 is wrong on big-endian systems, it at
least matches what we do for 16-bit (RGB565) and 32-bit (XRGB8888)
formats, so if we're wrong, we'll at least be consistently wrong.
@icculus
Copy link
Collaborator

icculus commented Aug 8, 2022

This no longer crashes here with the RGB888 fixes, so I'm closing this. Please let me know if it's still an issue that I'm just dodging by luck, though!

@icculus icculus closed this as completed Aug 8, 2022
@sulix
Copy link
Contributor

sulix commented Aug 8, 2022

Yup — I think this is fixed on the sdl12-compat side.

And schismtracker released a new SDL2-based version yesterday, too…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants