diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-04-09 15:37:55 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-03 12:10:24 +0200 |
commit | 64f6581129aa8041288b57ab758fe402aa958874 (patch) | |
tree | 6b7f76f0c96f78bda942b53ed6e83f454343f955 /libavcodec | |
parent | 01167ee6d5186e0f5cc798760efe82bb3ab7e3cd (diff) | |
download | ffmpeg-64f6581129aa8041288b57ab758fe402aa958874.tar.gz |
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 20ade59d9633def4ebf84ec170f56367bfb6aa6c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/dpcm.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index 5958081b66..c7712ad412 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -305,9 +305,8 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, shift[ch] -= (2 * n); diff = sign_extend((diff &~ 3) << 8, 16); - /* saturate the shifter to a lower limit of 0 */ - if (shift[ch] < 0) - shift[ch] = 0; + /* saturate the shifter to 0..31 */ + shift[ch] = av_clip_uintp2(shift[ch], 5); diff >>= shift[ch]; predictor[ch] += diff; |