subparse: don't reset allowed tags
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Thu, 7 Jul 2016 15:37:51 +0000 (17:37 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Thu, 7 Jul 2016 17:38:07 +0000 (19:38 +0200)
When a discont buffer is processed, the state is re-initialized, which
nullifies the allowed_tags.

The problem is when a subrip string with tags is processed and allowed_tags is
NULL. The function subrip_unescape_formatting() calls g_strjoinv with a
str_array as NULL, leading to a GLib-CRITICAL.

This patch removes the allowed_tags resetting, in parser_state_init(), but
move it into gst_sub_parse_format_autodetect().

https://bugzilla.gnome.org/show_bug.cgi?id=768525

gst/subparse/gstsubparse.c

index c8acc06..ef23add 100644 (file)
@@ -1353,7 +1353,6 @@ parser_state_init (ParserState * state)
   state->max_duration = 0;      /* no limit */
   state->state = 0;
   state->segment = NULL;
-  state->allowed_tags = NULL;
 }
 
 static void
@@ -1575,6 +1574,7 @@ gst_sub_parse_format_autodetect (GstSubParse * self)
   self->parser_type = format;
   self->subtitle_codec = gst_sub_parse_get_format_description (format);
   parser_state_init (&self->state);
+  self->state.allowed_tags = NULL;
 
   switch (format) {
     case GST_SUB_PARSE_FORMAT_MDVDSUB: