Skip to content

Commit

Permalink
Fixed bug 2855 - Segfault CreateMIDIEventList
Browse files Browse the repository at this point in the history
Jean-Baptiste Noblot

A Segfault is possible because eventList line 383 (native_midi_common.c)
is affected with MIDItoStream and is possible to return NULL without set mididata->tracks. But 2 lines later we use
mididata->tracks[trackID](SEGFAULT)
  • Loading branch information
slouken committed Oct 13, 2017
1 parent 4815237 commit 3aceecb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion native_midi/native_midi_common.c
Expand Up @@ -383,7 +383,11 @@ MIDIEvent *CreateMIDIEventList(SDL_RWops *src, Uint16 *division)
*division = mididata->division;

eventList = MIDItoStream(mididata);

if (eventList == NULL)
{
free(mididata);
return NULL;
}
for(trackID = 0; trackID < mididata->nTracks; trackID++)
{
if (mididata->track[trackID].data)
Expand Down

0 comments on commit 3aceecb

Please sign in to comment.