ffmpeg | branch: release/2.8 | Michael Niedermayer <mich...@niedermayer.cc> | 
Thu Apr  9 15:37:55 2020 +0200| [e6dcdee17014c7096f229d0359fc699636623acf] | 
committer: Michael Niedermayer

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 <an...@khirnov.net>
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
(cherry picked from commit 20ade59d9633def4ebf84ec170f56367bfb6aa6c)
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

 libavcodec/dpcm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c
index c13945edb6..16e8920e86 100644
--- a/libavcodec/dpcm.c
+++ b/libavcodec/dpcm.c
@@ -276,9 +276,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;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to