summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamian Ziobro <damian@xmementoit.com>2014-05-28 09:18:49 +0100
committerSebastian Dröge <sebastian@centricular.com>2014-05-28 10:58:21 +0200
commit5ca7684b7da50803376c2273f6070af84f64ffdc (patch)
tree93db32eba793c0d600ad3c1c4e6da9d040298ecb
parent2f39a3d711880862a346501a17025141d6aa3e40 (diff)
downloadgstreamer-plugins-bad-5ca7684b7da50803376c2273f6070af84f64ffdc.tar.gz
hlsdemux: Make parsing of "-quoted key URIs more resilient
https://bugzilla.gnome.org/show_bug.cgi?id=730830
-rw-r--r--ext/hls/m3u8.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c
index 618d52d1b..d66da2d47 100644
--- a/ext/hls/m3u8.c
+++ b/ext/hls/m3u8.c
@@ -479,13 +479,25 @@ gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated)
if (g_str_equal (a, "URI")) {
gchar *key = g_strdup (v);
gchar *keyp = key;
- int len = strlen (key);
-
- /* handle the \"key\" case */
- if (key[len - 1] == '"')
- key[len - 1] = '\0';
- if (key[0] == '"')
- key += 1;
+ gchar *key_ret;
+
+ /* handle the \"key\" case *
+ * there are sometimes situations where we have white signs
+ * before or after \" sign of URL therefore we are using for loops
+ * in order to remove first and last \" sign from decryption key URI */
+ key_ret = strchr (key, '"');
+ if (key_ret != NULL) {
+ /* found initialization quotation mark key URI */
+ key = key_ret + 1;
+ key_ret = strchr (key, '"');
+ if (key_ret != NULL) {
+ /* found finalizing quotation mark inside key URI */
+ key_ret[0] = '\0';
+ } else {
+ GST_WARNING
+ ("Decryption key URL parsing - cannot find finalizing quotation mark");
+ }
+ }
self->key =
uri_join (self->base_uri ? self->base_uri : self->uri, key);