OSDN Git Service

lavf/avio: check for : in filenames for protocols.
authorNicolas George <nicolas.george@normalesup.org>
Wed, 27 Feb 2013 18:19:15 +0000 (19:19 +0100)
committerNicolas George <nicolas.george@normalesup.org>
Thu, 28 Feb 2013 18:30:56 +0000 (19:30 +0100)
If the first "special" character in a filename is a comma,
it can introduce protocol options, but only if there is a
colon at the end. Otherwise, it is just a filename with a
comma.

Fix trac ticket #2303.

libavformat/avio.c

index b00cc9d..f6af0cb 100644 (file)
@@ -220,7 +220,9 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags,
                                      "Missing call to av_register_all()?\n");
     }
 
-    if (filename[proto_len] != ':' &&  filename[proto_len] != ',' || is_dos_path(filename))
+    if (filename[proto_len] != ':' &&
+        (filename[proto_len] != ',' || !strchr(filename + proto_len + 1, ':')) ||
+        is_dos_path(filename))
         strcpy(proto_str, "file");
     else
         av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str)));