aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-09-09 15:51:45 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-09-17 12:21:32 +0200
commit256ebf8bb4146d51da7d0cf1205c597627af1b04 (patch)
tree2198b496aab949a317c0ac6c927c28fdc3ef18ec /libavcodec
parent36c0958fbd9f85e2e263ef9b97eda26d49d439b4 (diff)
downloadffmpeg-256ebf8bb4146d51da7d0cf1205c597627af1b04.tar.gz
avcodec/dirac_vlc: limit res_bits in APPEND_RESIDUE()
Fixes: runtime error: left shift of 1073741838 by 1 places cannot be represented in type 'int32_t' (aka 'int') Fixes: 3279/clusterfuzz-testcase-minimized-4564805744590848 Suggested-by: <atomnuker> Reviewed-by: <atomnuker> 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 d98d29a775d6de9357731fec872642644e57b233) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dirac_vlc.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c
index b642ee8599..496d8177cd 100644
--- a/libavcodec/dirac_vlc.c
+++ b/libavcodec/dirac_vlc.c
@@ -37,7 +37,7 @@
#define APPEND_RESIDUE(N, M) \
N |= M >> (N ## _bits); \
- N ## _bits += (M ## _bits)
+ N ## _bits = (N ## _bits + (M ## _bits)) & 0x3F
int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
int bytes, uint8_t *_dst, int coeffs)
@@ -56,9 +56,6 @@ 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;