aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dirac_vlc.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2016-07-13 23:35:03 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2016-07-13 23:35:03 +0100
commite24c31b656254b2516befbde78aeaca0122a6010 (patch)
treec7c20e7784062514a30cf9beee6dbd7cccc9f6f9 /libavcodec/dirac_vlc.c
parente879819e7b271e08cfdea9cbcf0f879b04bd09c3 (diff)
downloadffmpeg-e24c31b656254b2516befbde78aeaca0122a6010.tar.gz
dirac_vlc: fix undefined shifts
Shifting by more than 63 bits is undefined behavior, athough any compiler not returning 0 after shifting by any amount would be insane. Found by Coverity, fixes CID1363959 and CID1363960 Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/dirac_vlc.c')
-rw-r--r--libavcodec/dirac_vlc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c
index d1271e56a0..caa6413e76 100644
--- a/libavcodec/dirac_vlc.c
+++ b/libavcodec/dirac_vlc.c
@@ -37,7 +37,7 @@ int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
int i, b, c_idx = 0;
int32_t *dst = (int32_t *)_dst;
DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]];
- INIT_RESIDUE(res, 0, 0);
+ INIT_RESIDUE(res, 0, 1);
#define APPEND_RESIDUE(N, M) \
N |= M >> (N ## _bits); \
@@ -81,7 +81,7 @@ int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
int i, b, c_idx = 0;
int16_t *dst = (int16_t *)_dst;
DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]];
- INIT_RESIDUE(res, 0, 0);
+ INIT_RESIDUE(res, 0, 1);
#define APPEND_RESIDUE(N, M) \
N |= M >> (N ## _bits); \