aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-01-17 14:26:05 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2022-04-09 22:19:40 +0200
commit423a3b685f318d989842959d30088f49bd2124ff (patch)
tree1ea4e4c0ab91ef0cd48909640671bebe8234397c
parent210b4b9871c21f1e9cdcaa8daeb9d4c64564a0dd (diff)
downloadffmpeg-423a3b685f318d989842959d30088f49bd2124ff.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.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index dfbd94dfc6..b266687656 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6897,6 +6897,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;