diff mbox series

[FFmpeg-devel,1/2] avcodec/wavarc: Fix k limit

Message ID 20230425183814.18486-1-michael@niedermayer.cc
State Accepted
Commit 40cec0b46570bb27a5a0145ceab932d0318e6e52
Headers show
Series [FFmpeg-devel,1/2] avcodec/wavarc: Fix k limit | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer April 25, 2023, 6:38 p.m. UTC
The implementation does not support k=32

Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 57976/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5911925807775744

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, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer July 22, 2023, 11:52 p.m. UTC | #1
On Tue, Apr 25, 2023 at 08:38:13PM +0200, Michael Niedermayer wrote:
> The implementation does not support k=32
> 
> Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
> Fixes: 57976/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5911925807775744
> 
> 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, 2 insertions(+), 2 deletions(-)

will apply patchset

[...]
diff mbox series

Patch

diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c
index 827803c91d..312e4beb7f 100644
--- a/libavcodec/wavarc.c
+++ b/libavcodec/wavarc.c
@@ -192,7 +192,7 @@  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)
+            if (k >= 32)
                 return AVERROR_INVALIDDATA;
         }
 
@@ -284,7 +284,7 @@  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)
+            if (k >= 32)
                 return AVERROR_INVALIDDATA;
         }