diff options
author | Dale Curtis <dalecurtis@chromium.org> | 2020-05-14 15:31:55 -0700 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-02 19:55:09 +0200 |
commit | c9672ca36330751f6c7455965d61634a94328fe0 (patch) | |
tree | 684c56e79b4af6395b80caa6cccceb46557d36b9 | |
parent | 34c4c9114cc718ab7371ca2cdd2c7bb1115cb18e (diff) | |
download | ffmpeg-c9672ca36330751f6c7455965d61634a94328fe0.tar.gz |
avformat/mov: Don't allow negative sample sizes.
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2d8d554f15a7a27cfeca81467cc9341a86f784e2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/mov.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index c02b157534..7d643071c2 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2663,6 +2663,10 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) for (i = 0; i < entries && !pb->eof_reached; i++) { sc->sample_sizes[i] = get_bits_long(&gb, field_size); + if (sc->sample_sizes[i] < 0) { + av_log(c->fc, AV_LOG_ERROR, "Invalid sample size %d\n", sc->sample_sizes[i]); + return AVERROR_INVALIDDATA; + } sc->data_size += sc->sample_sizes[i]; } |