diff mbox series

[FFmpeg-devel,3/3] avcodec/wavarc: Check k

Message ID 20230218231850.20522-3-michael@niedermayer.cc
State Accepted
Commit 4dee46426e6d23adda048414433c2887314a4267
Headers show
Series [FFmpeg-devel,1/3] avcodec/ffv1dec: Check that num h/v slices is supported | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Feb. 18, 2023, 11:18 p.m. UTC
Fixes: Assertion failure
Fixes: 55849/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6590105973555200

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

Patch

diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c
index b626daa66e..8d37af9571 100644
--- a/libavcodec/wavarc.c
+++ b/libavcodec/wavarc.c
@@ -192,6 +192,8 @@  static int decode_1dif(AVCodecContext *avctx,
         if (block_type < 4 && block_type >= 0) {
             k = 1 + (avctx->sample_fmt == AV_SAMPLE_FMT_S16P);
             k = get_urice(gb, k) + 1;
+            if (k > 32)
+                return AVERROR_INVALIDDATA;
         }
 
         switch (block_type) {
@@ -282,6 +284,8 @@  static int decode_2slp(AVCodecContext *avctx,
         if (block_type < 5 && block_type >= 0) {
             k = 1 + (avctx->sample_fmt == AV_SAMPLE_FMT_S16P);
             k = get_urice(gb, k) + 1;
+            if (k > 32)
+                return AVERROR_INVALIDDATA;
         }
 
         switch (block_type) {