subparse: Check for NULL return of strchr() when parsing LRC subtitles
authorSebastian Dröge <sebastian@centricular.com>
Wed, 9 Oct 2024 15:23:47 +0000 (11:23 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 3 Dec 2024 08:23:15 +0000 (08:23 +0000)
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/8051>

subprojects/gst-plugins-base/gst/subparse/gstsubparse.c

index 994cf62d1acc50f60a7564cb39a22441d1032413..4fe43d91003f661387712f565beda124d9689308 100644 (file)
@@ -1066,6 +1066,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