[FFmpeg-cvslog] avcodec/adpcm: Fix invalid shift in AV_CODEC_ID_ADPCM_PSX

Michael Niedermayer git at videolan.org
Thu Mar 12 01:08:30 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Mar  1 22:46:34 2020 +0100| [0a11ef68f0a85905e704e503b433f5aa645d59ac] | committer: Michael Niedermayer

avcodec/adpcm: Fix invalid shift in AV_CODEC_ID_ADPCM_PSX

Fixes: left shift of negative value -1
Fixes: 20859/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_PSX_fuzzer-5720391507247104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a11ef68f0a85905e704e503b433f5aa645d59ac
---

 libavcodec/adpcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index c69cac3379..4f5980f7d5 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1898,7 +1898,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
                             scale = sign_extend(byte, 4);
                         }
 
-                        scale  = scale << 12;
+                        scale  = scale * (1 << 12);
                         sample = (int)((scale >> shift) + (c->status[channel].sample1 * xa_adpcm_table[filter][0] + c->status[channel].sample2 * xa_adpcm_table[filter][1]) / 64);
                     }
                     *samples++ = av_clip_int16(sample);



More information about the ffmpeg-cvslog mailing list