[FFmpeg-devel] [PATCH 2/3] avcodec/adpcm: Make sample count computation match code accesing samplesfor AV_CODEC_ID_ADPCM_DTK

Michael Niedermayer michael at niedermayer.cc
Sat Jul 27 00:08:31 EEST 2024


Fixes: out of array access
Fixes: 70618/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_DTK_fuzzer-4814907107770368

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/adpcm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index afdbeaa15ee..8f9a8a8c8e2 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1050,6 +1050,8 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
         nb_samples = buf_size / (21 * ch) * 32;
         break;
     case AV_CODEC_ID_ADPCM_DTK:
+        nb_samples = buf_size / 32 * 28;
+        break;
     case AV_CODEC_ID_ADPCM_PSX:
         nb_samples = buf_size / (16 * ch) * 28;
         break;
-- 
2.45.2



More information about the ffmpeg-devel mailing list