aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-09-01 19:56:12 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-09-02 23:50:28 +0200
commitc595139f1fdb5ce5ee128c317ed9e4e836282436 (patch)
treefff16d012e214fc251037ff0adc33de481d09f37
parentf71cd44147e7a914f80fcfacca46c9e7b0374362 (diff)
downloadffmpeg-c595139f1fdb5ce5ee128c317ed9e4e836282436.tar.gz
avcodec/dirac_vlc: Fix invalid shift in ff_dirac_golomb_read_32bit()
Fixes: runtime error: shift exponent 64 is too large for 64-bit type 'residual' (aka 'unsigned long') Fixes: 2838/clusterfuzz-testcase-minimized-6260066086813696 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/dirac_vlc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c
index d3b9900beb..bd37f31f46 100644
--- a/libavcodec/dirac_vlc.c
+++ b/libavcodec/dirac_vlc.c
@@ -56,6 +56,9 @@ int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
if ((c_idx + 1) > coeffs)
return c_idx;
+ if (res_bits >= RSIZE_BITS)
+ res_bits = res = 0;
+
/* res_bits is a hint for better branch prediction */
if (res_bits && l->sign) {
int32_t coeff = 1;