diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-01-17 14:26:05 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-04-06 20:38:05 +0200 |
commit | 3a718e3bbb73f3cfb7d8eb5d00795e0c615e1226 (patch) | |
tree | 610337d5b44a449b6c4cedd7931eca8591cb68dd | |
parent | 671850fe550b309f6199e1811c59cc548bd21e8a (diff) | |
download | ffmpeg-3a718e3bbb73f3cfb7d8eb5d00795e0c615e1226.tar.gz |
avformat/mov: Check size before subtraction
Fixes: signed integer overflow: -9223372036854775808 - 8 cannot be represented in type 'long'
Fixes: 43542/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5237670148702208
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 d8d9d506a3de976b647bcbb8f76c7b8d30eff576)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/mov.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index c517830aef..e6785e884e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -7050,6 +7050,8 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (a.size == 0) { a.size = atom.size - total_size + 8; } + if (a.size < 0) + break; a.size -= 8; if (a.size < 0) break; |