From 4fa01d5e4cfdd636d78be423ab65ced46e43322f Mon Sep 17 00:00:00 2001 From: "Zhao, Gang" Date: Sat, 8 Feb 2025 22:44:47 +0800 Subject: [PATCH] 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: --- subprojects/gst-plugins-bad/gst/midi/midiparse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/gst/midi/midiparse.c b/subprojects/gst-plugins-bad/gst/midi/midiparse.c index d7bfd7ed6c..94c3c20f79 100644 --- a/subprojects/gst-plugins-bad/gst/midi/midiparse.c +++ b/subprojects/gst-plugins-bad/gst/midi/midiparse.c @@ -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; }