[FFmpeg-cvslog] avcodec/wavpack: Check value before shift in wp_exp2()

Michael Niedermayer git at videolan.org
Thu Mar 2 04:29:08 EET 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Feb 28 22:07:38 2017 +0100| [f8060ab927f89db8844b1a0e0709159662e6167b] | committer: Michael Niedermayer

avcodec/wavpack: Check value before shift in wp_exp2()

Fixes undefined shift, all callers should be changed to check the value
they use with wp_exp2() or its return value.

Fixes: 692/clusterfuzz-testcase-5757381516460032

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=f8060ab927f89db8844b1a0e0709159662e6167b
---

 libavcodec/wavpack.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/wavpack.h b/libavcodec/wavpack.h
index a1b46d5..0196574 100644
--- a/libavcodec/wavpack.h
+++ b/libavcodec/wavpack.h
@@ -171,6 +171,8 @@ static av_always_inline int wp_exp2(int16_t val)
 
     res   = wp_exp2_table[val & 0xFF] | 0x100;
     val >>= 8;
+    if (val > 31)
+        return INT_MIN;
     res   = (val > 9) ? (res << (val - 9)) : (res >> (9 - val));
     return neg ? -res : res;
 }



More information about the ffmpeg-cvslog mailing list