1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/dpcm: clip exponent into supported range in XAN DPCM

Fixes: shift exponent 32 is too large for 32-bit type 'int'
Fixes: 21200/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XAN_DPCM_fuzzer-5754704894361600

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 20ade59d96)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-04-09 15:37:55 +02:00
parent 01167ee6d5
commit 64f6581129

View File

@ -305,9 +305,8 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
shift[ch] -= (2 * n); shift[ch] -= (2 * n);
diff = sign_extend((diff &~ 3) << 8, 16); diff = sign_extend((diff &~ 3) << 8, 16);
/* saturate the shifter to a lower limit of 0 */ /* saturate the shifter to 0..31 */
if (shift[ch] < 0) shift[ch] = av_clip_uintp2(shift[ch], 5);
shift[ch] = 0;
diff >>= shift[ch]; diff >>= shift[ch];
predictor[ch] += diff; predictor[ch] += diff;