Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-12-04 22:48:54 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2022-04-07 17:27:00 +0300
commit2aefb4b7ac39a1f9707fb50502364093e4117895 (patch)
tree706949196328881955a056c67fe3708f78151253 /libavformat
parenta962cda7fd5da6e95e10f6b53eac0d28dc079e34 (diff)
avformat/mov: Check next offset in mov_read_dref()
Fixes: signed integer overflow: 9223372036200463215 + 1109914409 cannot be represented in type 'long' Fixes: 41480/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6553086177443840 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 562021e2fd4d74589905d9c566c686394d2b0526) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mov.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index b52a72fe30..91f2ed1bcb 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -603,11 +603,13 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
for (i = 0; i < entries; i++) {
MOVDref *dref = &sc->drefs[i];
uint32_t size = avio_rb32(pb);
- int64_t next = avio_tell(pb) + size - 4;
+ int64_t next = avio_tell(pb);
- if (size < 12)
+ if (size < 12 || next < 0 || next > INT64_MAX - size)
return AVERROR_INVALIDDATA;
+ next += size - 4;
+
dref->type = avio_rl32(pb);
avio_rb32(pb); // version + flags