diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-11-20 19:13:09 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-01-06 15:03:15 +0100 |
commit | 6f2f504d3e4c8116f8f97a064c0795fc89d5d04d (patch) | |
tree | 63543e173ab7e8c62e08356c08ba75b898a3c37d | |
parent | 7417d4f90833a89fcf9d612384e1c36b1c33490c (diff) | |
download | ffmpeg-6f2f504d3e4c8116f8f97a064c0795fc89d5d04d.tar.gz |
avcodec/adpcm: Fix invalid shift in xa_decode()
Fixes: left shift of negative value -1
Fixes: 18859/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_XA_fuzzer-5748474213040128
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 50db30b47d016fc4e7b47067545b15d22d4faddf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/adpcm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 5dc5704a4d..ee0de58a62 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -392,7 +392,7 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1, d = in[16+i+j*4]; t = sign_extend(d, 4); - s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6); + s = t*(1<<shift) + ((s_1*f0 + s_2*f1+32)>>6); s_2 = s_1; s_1 = av_clip_int16(s); out0[j] = s_1; @@ -419,7 +419,7 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1, d = in[16+i+j*4]; t = sign_extend(d >> 4, 4); - s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6); + s = t*(1<<shift) + ((s_1*f0 + s_2*f1+32)>>6); s_2 = s_1; s_1 = av_clip_int16(s); out1[j] = s_1; |