summaryrefslogtreecommitdiff
path: root/libavformat/ape.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-09-17 21:19:53 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-09-24 17:57:35 +0200
commitd0349c9929e2891c90011a83152624d5cf18e628 (patch)
treeb6f53b36eaeff72659a0cbfb1e9c7f5605c5b9c4 /libavformat/ape.c
parent1b47190c94317d0d1bb5c60a43005ed78b4808a2 (diff)
avformat/ape: Check frames size
Fixes: signed integer overflow: 9223372036854775806 + 3 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_APE_fuzzer-6389264140599296 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/ape.c')
-rw-r--r--libavformat/ape.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/ape.c b/libavformat/ape.c
index f904fde178..92e9ac7cb1 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -298,6 +298,8 @@ static int ape_read_header(AVFormatContext * s)
ape->frames[i].pos -= ape->frames[i].skip;
ape->frames[i].size += ape->frames[i].skip;
}
+ if (ape->frames[i].size > INT_MAX - 3)
+ return AVERROR_INVALIDDATA;
ape->frames[i].size = (ape->frames[i].size + 3) & ~3;
}
if (ape->fileversion < 3810) {