aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-27 23:38:47 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-06 11:30:43 +0100
commit43988fffd9eee4fe573574d5ce3136f9d1bf0ae9 (patch)
treed01aa5888267e46c98cb2a9ed8bcdbfd1eabbc05
parent2221f613ebb80dbc9af04242a7b1475a3f28ac4c (diff)
downloadffmpeg-43988fffd9eee4fe573574d5ce3136f9d1bf0ae9.tar.gz
avcodec/adpcm: Fix invalid shifts in ADPCM DTK
Fixes: left shift of negative value -1 Fixes: 18397/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_DTK_fuzzer-5675653487132672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 34e701ff93b664703e1bc1b1a6073fa058b02f34) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/adpcm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 4a5f104648..98cebb090d 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1637,7 +1637,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
else
sampledat = sign_extend(byte >> 4, 4);
- sampledat = (((sampledat << 12) >> (header & 0xf)) << 6) + prev;
+ sampledat = ((sampledat * (1 << 12)) >> (header & 0xf)) * (1 << 6) + prev;
*samples++ = av_clip_int16(sampledat >> 6);
c->status[channel].sample2 = c->status[channel].sample1;
c->status[channel].sample1 = sampledat;