[FFmpeg-cvslog] avcodec/utils: Check for integer overflow in get_audio_frame_duration() for ADPCM_DTK

Michael Niedermayer git at videolan.org
Sat Jan 23 02:06:14 EET 2021


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Nov  3 19:21:18 2020 +0100| [2488ba85a0fa5ee4125888258d3d95ce3f03bbb6] | committer: Michael Niedermayer

avcodec/utils: Check for integer overflow in get_audio_frame_duration() for ADPCM_DTK

Fixes: signed integer overflow: 131203586 * 28 cannot be represented in type 'int'
Fixes: 26817/clusterfuzz-testcase-minimized-ffmpeg_dem_MSF_fuzzer-6296902548848640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2488ba85a0fa5ee4125888258d3d95ce3f03bbb6
---

 libavcodec/utils.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index b2313860d0..aeb9c6de72 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1710,7 +1710,10 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
                 return frame_bytes / (9 * ch) * 16;
             case AV_CODEC_ID_ADPCM_PSX:
             case AV_CODEC_ID_ADPCM_DTK:
-                return frame_bytes / (16 * ch) * 28;
+                frame_bytes /= 16 * ch;
+                if (frame_bytes > INT_MAX / 28)
+                    return 0;
+                return frame_bytes * 28;
             case AV_CODEC_ID_ADPCM_4XM:
             case AV_CODEC_ID_ADPCM_IMA_DAT4:
             case AV_CODEC_ID_ADPCM_IMA_ISS:



More information about the ffmpeg-cvslog mailing list