[FFmpeg-devel] [PATCH 3/7] avcodec/alsdec: Fix integer overflow with buffer number

Michael Niedermayer michael at niedermayer.cc
Fri Jun 21 01:47:17 EEST 2019


Fixes: signed integer overflow: 65313 * 65313 cannot be represented in type 'int'
Fixes: 15290/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5738074249625600

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

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 79d22b7c2b..8e0d3e5f83 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1990,6 +1990,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     // allocate quantized parcor coefficient buffer
     num_buffers = sconf->mc_coding ? avctx->channels : 1;
+    if (num_buffers * (uint64_t)num_buffers > INT_MAX)
+        return AVERROR_INVALIDDATA;
 
     ctx->quant_cof        = av_malloc_array(num_buffers, sizeof(*ctx->quant_cof));
     ctx->lpc_cof          = av_malloc_array(num_buffers, sizeof(*ctx->lpc_cof));
-- 
2.22.0



More information about the ffmpeg-devel mailing list