[FFmpeg-cvslog] avcodec/wavpack: Check shift

Michael Niedermayer git at videolan.org
Tue Mar 21 21:57:41 EET 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Mar 20 02:05:23 2017 +0100| [423375d4f06ae7103e575a31c23e62e3ba440845] | committer: Michael Niedermayer

avcodec/wavpack: Check shift

Fixes: runtime error: shift exponent 255 is too large for 32-bit type 'unsigned int'
Fixes: 894/clusterfuzz-testcase-4841537823309824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=423375d4f06ae7103e575a31c23e62e3ba440845
---

 libavcodec/wavpack.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 3d0b01f..2bda359 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -861,6 +861,12 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
                 s->and   = 1;
                 s->shift = val[3];
             }
+            if (s->shift > 31) {
+                av_log(avctx, AV_LOG_ERROR,
+                       "Invalid INT32INFO, shift = %d (> 31)\n", s->shift);
+                s->and = s->or = s->shift = 0;
+                continue;
+            }
             /* original WavPack decoder forces 32-bit lossy sound to be treated
              * as 24-bit one in order to have proper clipping */
             if (s->hybrid && bpp == 4 && s->post_shift < 8 && s->shift > 8) {



More information about the ffmpeg-cvslog mailing list