[FFmpeg-devel] [PATCH 4/6] avcodec/wavarc: Check k in decode_5elp()

Michael Niedermayer michael at niedermayer.cc
Thu Sep 21 21:09:10 EEST 2023


regression since 18b2ecc24778140c2bc798ed64842dc8feb6dc3a

Fixes: assertion failure
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6280165808013312

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

diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c
index 9ba95143b8a..a9d98f0c55e 100644
--- a/libavcodec/wavarc.c
+++ b/libavcodec/wavarc.c
@@ -539,6 +539,8 @@ static int decode_5elp(AVCodecContext *avctx,
         if (block_type >= 0 && block_type <= 7) {
             k = 1 + (avctx->sample_fmt == AV_SAMPLE_FMT_S16P);
             k = get_urice(gb, k) + 1;
+            if (k >= 32)
+                return AVERROR_INVALIDDATA;
         }
 
         if (block_type <=  2 || block_type ==  6 || block_type == 13 ||
-- 
2.17.1



More information about the ffmpeg-devel mailing list