aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/webmdashenc.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2017-04-20 16:17:44 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-17 20:35:19 +0200
commitb1d5c2de2bbf31cb4aa0a88798000cafd318d75b (patch)
tree1c438aad3c003929728676f4d9dbb5cec224bb3f /libavformat/webmdashenc.c
parent351dc1f33a65e221172c22d5569de2df2997fe24 (diff)
downloadffmpeg-b1d5c2de2bbf31cb4aa0a88798000cafd318d75b.tar.gz
avformat/webmdashenc: Validate the 'streams' adaptation sets parameter
It should not be a value larger than the number of streams we have, or it will cause invalid reads and/or SIGSEGV. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit ec07efa70012845e8642df67a4a773f510a17088) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/webmdashenc.c')
-rw-r--r--libavformat/webmdashenc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index cf536129e4..757cf8b030 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -462,7 +462,11 @@ static int parse_adaptation_sets(AVFormatContext *s)
if (as->streams == NULL)
return AVERROR(ENOMEM);
as->streams[as->nb_streams - 1] = to_integer(p, q - p + 1);
- if (as->streams[as->nb_streams - 1] < 0) return -1;
+ if (as->streams[as->nb_streams - 1] < 0 ||
+ as->streams[as->nb_streams - 1] >= s->nb_streams) {
+ av_log(s, AV_LOG_ERROR, "Invalid value for 'streams' in adapation_sets.\n");
+ return AVERROR(EINVAL);
+ }
if (*q == '\0') break;
if (*q == ' ') state = new_set;
p = ++q;