Browse Source

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 ec07efa700)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.3.1
Derek Buitenhuis Michael Niedermayer 8 years ago
parent
commit
2ff9e21f7f
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      libavformat/webmdashenc.c

+ 5
- 1
libavformat/webmdashenc.c View File

@@ -462,7 +462,11 @@ static int parse_adaptation_sets(AVFormatContext *s)
if (as->streams == NULL) if (as->streams == NULL)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
as->streams[as->nb_streams - 1] = to_integer(p, q - p + 1); 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 == '\0') break;
if (*q == ' ') state = new_set; if (*q == ' ') state = new_set;
p = ++q; p = ++q;


Loading…
Cancel
Save