decoders/smpeg.c patch (fixes smpeg error-reporting crash)

interim.descriptor at gmail.com interim.descriptor at gmail.com
Sat Sep 16 07:12:57 EDT 2006


decoders/smpeg.c contains the following fun snippet of code on line 174:

    if (SMPEG_error(smpeg))
    {
            SMPEG_delete(smpeg);
            BAIL_MACRO(SMPEG_error(smpeg), 0);
    } /* if */



Notice how first the smpeg pointer is deleted, and THEN we call 
BAIL_MACRO() using the deleted smpeg pointer as an argument. This can 
make SDL_sound crash when decoding a bad mp3.

My tested solution was to replace the above code with this:

    char *errMsg=SMPEG_error(smpeg);
    if (errMsg)
    {
            SMPEG_delete(smpeg);
            BAIL_MACRO(errMsg, 0);
    } /* if */


SDL_Sound now fails gracefully when decoding bad mp3s, instead of crashing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/sdlsound/attachments/20060916/cc5b7f58/attachment.htm>


More information about the sdlsound mailing list