[FFmpeg-devel] [PATCH 2/2] avcodec/dstdec: Check sample rate

Michael Niedermayer michael at niedermayer.cc
Fri Feb 14 00:24:56 EET 2020


Fixes: out of array access
Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5735812071424000

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/dstdec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c
index bdabced823..0505d3fde5 100644
--- a/libavcodec/dstdec.c
+++ b/libavcodec/dstdec.c
@@ -86,6 +86,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return AVERROR_PATCHWELCOME;
     }
 
+    if (DST_SAMPLES_PER_FRAME(avctx->sample_rate) & 7) {
+        avpriv_request_sample(avctx, "sample rate %d", avctx->sample_rate);
+        return AVERROR_PATCHWELCOME;
+    }
+
     avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
 
     for (i = 0; i < avctx->channels; i++)
-- 
2.17.1



More information about the ffmpeg-devel mailing list