aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dirac_vlc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-07-28 02:23:25 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-08-01 13:54:43 +0200
commit46e407554968e7258c874f4caf517172ffa285cf (patch)
tree10bcbac941556f34e958a739997b1b9b249b7396 /libavcodec/dirac_vlc.c
parent8f2f166c99df9d0fcfdabe3adb2041f9fa3bfaa2 (diff)
downloadffmpeg-46e407554968e7258c874f4caf517172ffa285cf.tar.gz
avcodec/dirac_vlc: Fix invalid shift
Fixes: runtime error: shift exponent 65 is too large for 64-bit type 'residual' (aka 'unsigned long') Fixes: 2737/clusterfuzz-testcase-minimized-4968639147016192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/dirac_vlc.c')
-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 773f720858..d3b9900beb 100644
--- a/libavcodec/dirac_vlc.c
+++ b/libavcodec/dirac_vlc.c
@@ -96,6 +96,9 @@ int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
if ((c_idx + 1) > coeffs)
return c_idx;
+ if (res_bits >= RSIZE_BITS)
+ res_bits = res = 0;
+
if (res_bits && l->sign) {
int32_t coeff = 1;
APPEND_RESIDUE(res, l->preamble);