midiparse: Quit parsing if error occurred

Invalid midi files will crash gstreamer or let it enter infinite
loop. Fixed it by quit parsing if error is encountered.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8396>
This commit is contained in:
Zhao, Gang 2025-02-08 22:44:47 +08:00 committed by GStreamer Marge Bot
parent 43e3796d7d
commit 4fa01d5e4c

View File

@ -1000,7 +1000,8 @@ parse_MTrk (GstMidiParse * midiparse, guint8 * data, guint size)
/* now loop over all events and calculate the duration */
while (!track->eot) {
handle_next_event (midiparse, track, NULL, NULL);
if (handle_next_event (midiparse, track, NULL, NULL) != GST_FLOW_OK)
return FALSE;
}