From 161254d7c0cd2866b05d35d4aa1eed7e876779fc Mon Sep 17 00:00:00 2001 From: Alex Ashley Date: Fri, 21 Feb 2014 09:36:51 +0000 Subject: [PATCH] hlsdemux: Fix parsing of CODECS and RESOLUTION hlsdemux does not check for the '"' character in #EXT-X-STREAM-INF attributes. The CODECS parameter is an example of an attribute that might use the '"' symbol and might contain a ',' character inside this quoted string. For example: CODECS="avc1.77.30, mp4a.40.2" hlsdemux does not correctly parse the RESOLUTION attribute, it assumes that an '=' character is used to delineate the width and height values, but the HLS RFC states that a 'x' character must be used as the delimiter between width and height. https://bugzilla.gnome.org/show_bug.cgi?id=725140 --- ext/hls/m3u8.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c index b1eee74c76..a9520efedd 100644 --- a/ext/hls/m3u8.c +++ b/ext/hls/m3u8.c @@ -168,7 +168,7 @@ double_from_string (gchar * ptr, gchar ** endptr, gdouble * val) static gboolean parse_attributes (gchar ** ptr, gchar ** a, gchar ** v) { - gchar *end, *p; + gchar *end=NULL, *p; g_return_val_if_fail (ptr != NULL, FALSE); g_return_val_if_fail (*ptr != NULL, FALSE); @@ -179,6 +179,19 @@ parse_attributes (gchar ** ptr, gchar ** a, gchar ** v) *a = *ptr; end = p = g_utf8_strchr (*ptr, -1, ','); + if(end){ + gchar *q = g_utf8_strchr (*ptr, -1, '"'); + if(q && qwidth)) GST_WARNING ("Error while reading RESOLUTION width"); - if (!v || *v != '=') { + if (!v || *v != 'x') { GST_WARNING ("Missing height"); } else { v = g_utf8_next_char (v);