aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-16 13:30:29 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:37:21 +0200
commit6778e41252a4c4f78f30638c9e66447d8d3ed2ef (patch)
tree1c67070bf8fda6951ce6282d1c1a1e85842df7ab /libavcodec
parent85cf8124426ad9e5ab981aa1525aadd4e623f073 (diff)
downloadffmpeg-6778e41252a4c4f78f30638c9e66447d8d3ed2ef.tar.gz
avcodec/utils: Check for overflow with ATRAC* in get_audio_frame_duration()
Fixes: signed integer overflow: 1024 * 13129048 cannot be represented in type 'int' Fixes: 26378/clusterfuzz-testcase-minimized-ffmpeg_dem_CODEC2RAW_fuzzer-5634018353348608 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 01bb12f883dccc419317516e093fdc6dfa41bc31) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index cba04a2f59..830bebc8c7 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1573,7 +1573,10 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
case AV_CODEC_ID_MP1: return 384;
case AV_CODEC_ID_ATRAC1: return 512;
case AV_CODEC_ID_ATRAC9:
- case AV_CODEC_ID_ATRAC3: return 1024 * framecount;
+ case AV_CODEC_ID_ATRAC3:
+ if (framecount > INT_MAX/1024)
+ return 0;
+ return 1024 * framecount;
case AV_CODEC_ID_ATRAC3P: return 2048;
case AV_CODEC_ID_MP2:
case AV_CODEC_ID_MUSEPACK7: return 1152;