diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-09-17 21:19:53 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-09-24 22:49:30 +0200 |
commit | 225d003f5b944a96ede6d6d964b69e8d0eea7f50 (patch) | |
tree | 91ba8f8b261cc42b6b1d642ad3e9e00c8d00f38b /libavformat | |
parent | 65bc53d6080f997c604083a4cb5fa7d706df2e7a (diff) | |
download | ffmpeg-225d003f5b944a96ede6d6d964b69e8d0eea7f50.tar.gz |
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>
(cherry picked from commit d0349c9929e2891c90011a83152624d5cf18e628)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/ape.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/ape.c b/libavformat/ape.c index 3a3b91283e..c3cc7b6445 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -323,6 +323,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) { |