[FFmpeg-cvslog] avcodec/adpcm: Fix overflow in FFABS() IMA_EA_EACS

Michael Niedermayer git at videolan.org
Fri Apr 24 02:13:02 EEST 2020


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Sat Dec  7 00:14:16 2019 +0100| [0dc4c9f7454a6200e7ed5325afc7f2a9f8de7dc4] | committer: Michael Niedermayer

avcodec/adpcm: Fix overflow in FFABS() IMA_EA_EACS

Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 19235/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_EA_EACS_fuzzer-5680878952382464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 794352ae9d1cb32b4b9e45d3affb83763f4ee12e)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 8b62475319..75ee685b16 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1066,7 +1066,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
         }
         for (i=0; i<=st; i++) {
             c->status[i].predictor  = bytestream2_get_le32u(&gb);
-            if (FFABS(c->status[i].predictor) > (1<<16))
+            if (FFABS((int64_t)c->status[i].predictor) > (1<<16))
                 return AVERROR_INVALIDDATA;
         }
 



More information about the ffmpeg-cvslog mailing list