1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

avformat/mov: Check a.size before computing next_root_atom

Fixes: signed integer overflow: 64 + 9223372036854775799 cannot be represented in type 'long'
Fixes: 27563/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6244650163372032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8c9a5a0fe9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-11-28 21:20:43 +01:00
parent 3df814c735
commit 0c45348bef

View File

@ -6898,7 +6898,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
c->atom_depth --;
return err;
}
if (c->found_moov && c->found_mdat &&
if (c->found_moov && c->found_mdat && a.size <= INT64_MAX - start_pos &&
((!(pb->seekable & AVIO_SEEKABLE_NORMAL) || c->fc->flags & AVFMT_FLAG_IGNIDX || c->frag_index.complete) ||
start_pos + a.size == avio_size(pb))) {
if (!(pb->seekable & AVIO_SEEKABLE_NORMAL) || c->fc->flags & AVFMT_FLAG_IGNIDX || c->frag_index.complete)