aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-01-20 09:43:54 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-02-01 02:12:21 +0100
commit5af593290488514812527ad2ea3818dae4d41646 (patch)
treeac351f31484d7a3f09c7dc11674aad42dacd3680 /libavformat
parenta9a6e4e9c1f6d87cece9448fc9a495ac9b62e720 (diff)
downloadffmpeg-5af593290488514812527ad2ea3818dae4d41646.tar.gz
avformat/avio: Limit url option parsing to the documented cases
This feature is not know much or used much AFAIK, and it might be helpfull in exploits. No specific case is known where it can be used in an exploit though subsequent commits depend on this commit though Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 984d58a3440d513f66344b5332f6b589c0a6bbc6) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avio.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 326bb0aa78..78d15cc40d 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -155,9 +155,16 @@ static int url_alloc_for_protocol(URLContext **puc, struct URLProtocol *up,
char sep= *++p;
char *key, *val;
p++;
+
+ if (strcmp(up->name, "subfile"))
+ ret = AVERROR(EINVAL);
+
while(ret >= 0 && (key= strchr(p, sep)) && p<key && (val = strchr(key+1, sep))){
*val= *key= 0;
- ret= av_opt_set(uc->priv_data, p, key+1, 0);
+ if (strcmp(p, "start") && strcmp(p, "end")) {
+ ret = AVERROR_OPTION_NOT_FOUND;
+ } else
+ ret= av_opt_set(uc->priv_data, p, key+1, 0);
if (ret == AVERROR_OPTION_NOT_FOUND)
av_log(uc, AV_LOG_ERROR, "Key '%s' not found.\n", p);
*val= *key= sep;
@@ -222,7 +229,7 @@ static struct URLProtocol *url_find_protocol(const char *filename)
size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
if (filename[proto_len] != ':' &&
- (filename[proto_len] != ',' || !strchr(filename + proto_len + 1, ':')) ||
+ (strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) ||
is_dos_path(filename))
strcpy(proto_str, "file");
else