aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpc8.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-07-11 20:02:24 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-02 19:41:48 +0100
commit65c25ad3688a4cda94e9b03142cc7c4f90c397d3 (patch)
tree6ac785d2441f15e39adab521d1a1c0278bec4d30 /libavcodec/mpc8.c
parent54b3727a494c9b08f805ad9453899ab4d7c2b930 (diff)
downloadffmpeg-65c25ad3688a4cda94e9b03142cc7c4f90c397d3.tar.gz
avcodec/mpc8: Fixes invalid shift in mpc8_decode_frame()
Fixes: left shift of negative value -456 Fixes: 15561/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPC8_fuzzer-5758130404720640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Suggested-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 1dbb67d39b21ed320edd2b1599b502518250cfd3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/mpc8.c')
-rw-r--r--libavcodec/mpc8.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index 8894457c7e..f5891a158d 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -362,8 +362,9 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
for(j = 0; j < SAMPLES_PER_BAND; j += SAMPLES_PER_BAND / 2){
cnt = get_vlc2(gb, q1_vlc.table, MPC8_Q1_BITS, 2);
t = mpc8_get_mask(gb, 18, cnt);
- for(k = 0; k < SAMPLES_PER_BAND / 2; k++, t <<= 1)
- c->Q[ch][off + j + k] = (t & 0x20000) ? (get_bits1(gb) << 1) - 1 : 0;
+ for(k = 0; k < SAMPLES_PER_BAND / 2; k++)
+ c->Q[ch][off + j + k] = t & (1 << (SAMPLES_PER_BAND / 2 - k - 1))
+ ? (get_bits1(gb) << 1) - 1 : 0;
}
break;
case 2: