diff --git a/ChangeLog b/ChangeLog index 9f19e0333f..81e21062d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-03-09 Tim-Philipp Müller + + * gst/subparse/gstsubparse.c: (gst_subparse_type_find): + Fix invalid memory access: make sure string passed to + regexec() is NUL-termianted. + 2006-03-09 Tim-Philipp Müller * gst/typefind/gsttypefindfunctions.c: (mp3_type_find_at_offset), diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index 0a324bea5b..df66006f00 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -867,10 +867,16 @@ gst_subparse_type_find (GstTypeFind * tf, gpointer private) { const guint8 *data; GstSubParseFormat format; + gchar *str; if (!(data = gst_type_find_peek (tf, 0, 36))) return; - format = gst_sub_parse_data_format_autodetect ((gchar *) data); + + /* make sure string passed to _autodetect() is NUL-terminated */ + str = g_strndup ((gchar *) data, 35); + format = gst_sub_parse_data_format_autodetect (str); + g_free (str); + switch (format) { case GST_SUB_PARSE_FORMAT_MDVDSUB: GST_DEBUG ("MicroDVD format detected");