We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2601 - Mix_SetError(NULL) segfaults
Summary: Mix_SetError(NULL) segfaults
Status: RESOLVED FIXED
Alias: None
Product: SDL_mixer
Classification: Unclassified
Component: misc (show other bugs)
Version: 2.0.0
Hardware: ARM Android (All)
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-22 20:53 UTC by beuc
Modified: 2014-06-26 04:04 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description beuc 2014-06-22 20:53:43 UTC
This commits https://hg.libsdl.org/SDL_mixer/rev/6f2ff3d6e04d makes SDL_Mixer segfault.

At first glance this doesn't make sense (fmt==NULL is handled in SDL_SetError), but looking at #define SDL_DYNAPI_VARARGS it seems there's a stub wrapper that doesn't handle fmt==NULL.
(I'm not sure why there's this wrapper in the first place?)

It seems to match the stacktrace (crash when calling SDL_vsnprintf):
I/DEBUG   (  143): backtrace:
I/DEBUG   (  143):     #00  pc 00022ea6  /system/lib/libc.so (__vfprintf+269)
I/DEBUG   (  143):     #01  pc 0002487d  /system/lib/libc.so (vsnprintf+72)
I/DEBUG   (  143):     #02  pc 0006a2ef  /data/app-lib/org.freedink-1/libSDL2.so (SDL_vsnprintf_REAL+2)
I/DEBUG   (  143):     #03  pc 0004d535  /data/app-lib/org.freedink-1/libSDL2.so (SDL_SetError+36)
I/DEBUG   (  143):     #04  pc 000149c8  /data/app-lib/org.freedink-1/libSDL2_mixer.so (Mix_LoadMUS+168)
I/DEBUG   (  143):     #05  pc 0000d7cc  /data/app-lib/org.freedink-1/libmain.so (PlayMidi+260)

I would suggest either reverting the commit to Mix_SetError("") or fix the SDL_DYNAPI_VARARGS:SDL_SetError stub.
Comment 1 Sam Lantinga 2014-06-25 08:36:50 UTC
This should be fixed in the latest snapshot:
http://www.libsdl.org/tmp/SDL-2.0.zip

Can you verify?
Comment 2 beuc 2014-06-25 16:39:54 UTC
That works - but configure.in needs to reference SDL 2.0.4 then :)

SDL_VERSION=2.0.4
AM_PATH_SDL2($SDL_VERSION,
            :,
            AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
)


(incidentally I get a new, unrelated segfault in Android_JNI_FileOpen when using relative filenames, I'll try and send a separate report if I get the time)
Comment 3 Sam Lantinga 2014-06-25 16:45:40 UTC
If it works with the published release of 2.0.3 and will work with the 2.0.4 release, I think we're fine.
Comment 4 beuc 2014-06-25 17:04:29 UTC
It does not work with 2.0.3.

More precisely, the situation where it does not work is:
- SDL2-2.0.3
- SDL2_Mixer-hg-80c2a4592ff4

The situation where it works is:
- SDL2-hg-c9be8299ba6b
- SDL2_Mixer-hg-80c2a4592ff4
Comment 5 Sam Lantinga 2014-06-26 04:04:54 UTC
Okay, thanks for the heads up.

This should be fixed now.
https://hg.libsdl.org/SDL_mixer/rev/3af92aa761d2