From: Edward Hervey Date: Wed, 30 May 2018 09:39:40 +0000 (+0200) Subject: subparse: Don't read beyond array X-Git-Tag: accepted/tizen/unified/20181113.163401~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2686a0b61c2cb282d3e9d3bbadac42adde4903eb;p=platform%2Fupstream%2Fgst-plugins-base.git subparse: Don't read beyond array - This is from upstream. - If num_open_tags is 0, we shouldn't try to get the "last" open tag since there isn't any. Change-Id: I097101c435637e35961877809faaa6641f5ff441 --- diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index 0987585..a8c0438 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -864,7 +864,9 @@ subrip_fix_up_markup (gchar ** p_txt, gconstpointer allowed_tags_ptr) if (*next_tag == '<' && *(next_tag + 1) == '/') { end_tag = strchr (cur, '>'); if (end_tag) { - const gchar *last = g_ptr_array_index (open_tags, num_open_tags - 1); + const gchar *last = NULL; + if (num_open_tags > 0) + last = g_ptr_array_index (open_tags, num_open_tags - 1); if (num_open_tags == 0 || g_ascii_strncasecmp (end_tag - 1, last, strlen (last))) { GST_LOG ("broken input, closing tag '%s' is not open", end_tag - 1);