<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
decoders/smpeg.c contains the following fun snippet of code on line 174:<br>
<blockquote><tt>if (SMPEG_error(smpeg))<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SMPEG_delete(smpeg);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BAIL_MACRO(SMPEG_error(smpeg), 0);<br>
} /* if */</tt><br>
</blockquote>
<br>
<br>
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.<br>
<br>
My tested solution was to replace the above code with this:<br>
<blockquote><tt>char *errMsg=SMPEG_error(smpeg);<br>
if (errMsg)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SMPEG_delete(smpeg);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BAIL_MACRO(errMsg, 0);<br>
} /* if */<br>
  </tt><br>
</blockquote>
<br>
SDL_Sound now fails gracefully when decoding bad mp3s, instead of
crashing.<br>
</body>
</html>