aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-30 03:13:21 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-31 02:44:17 +0200
commit343c1d1d7d1fbc2a28c16de9c39530780974a24b (patch)
tree4548fe1880c4ca4db6c6a88ba24a4e25e1fa9c21
parentd542185e054192fb3028512c0dae2187cf29607e (diff)
downloadffmpeg-343c1d1d7d1fbc2a28c16de9c39530780974a24b.tar.gz
avcodec/wavpack: Check float_shift
Fixes: runtime error: shift exponent 40 is too large for 32-bit type 'unsigned int' Fixes: 1898/clusterfuzz-testcase-minimized-5970744880136192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 4020b009d1e88ff10abd25fb768165afa546851d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/wavpack.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index a679d424eb..3bc345e797 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -872,6 +872,12 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
s->float_flag = bytestream2_get_byte(&gb);
s->float_shift = bytestream2_get_byte(&gb);
s->float_max_exp = bytestream2_get_byte(&gb);
+ if (s->float_shift > 31) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Invalid FLOATINFO, shift = %d (> 31)\n", s->float_shift);
+ s->float_shift = 0;
+ continue;
+ }
got_float = 1;
bytestream2_skip(&gb, 1);
break;