summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-01-17 14:26:05 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2022-02-01 16:50:27 +0100
commitd8d9d506a3de976b647bcbb8f76c7b8d30eff576 (patch)
treed664c237152f45d103889405ff6dc4aeb8e28031 /libavformat/mov.c
parentcd6ac013a00373126bf3d313743d39b5edd5428a (diff)
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>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1437d160f8..a80fcc1606 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7329,6 +7329,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;