mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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>
This commit is contained in:
parent
9eb0d76e25
commit
2ff9e21f7f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user