subparse: Check for NULL return of strchr() when parsing LRC subtitles

Thanks to Antonio Morales for finding and reporting the issue.

Fixes GHSL-2024-263
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3892

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8039>
This commit is contained in:
Sebastian Dröge 2024-10-09 11:23:47 -04:00 committed by GStreamer Marge Bot
parent 403b10eba0
commit 4c40f73b70

View file

@ -1070,6 +1070,11 @@ parse_lrc (ParserState * state, const gchar * line)
return NULL;
start = strchr (line, ']');
// sscanf() does not check for the trailing ] but only up to the last
// placeholder, so there might be no ] at the end.
if (!start)
return NULL;
if (start - line == 9)
milli = 10;
else