diff mbox

[FFmpeg-devel,1/2] avcodec/adpcm: Fix overflow in FFABS() IMA_EA_EACS

Message ID 20191207092404.21682-1-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer Dec. 7, 2019, 9:24 a.m. UTC
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@niedermayer.cc>
---
 libavcodec/adpcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Jan. 11, 2020, 10:41 p.m. UTC | #1
On Sat, Dec 07, 2019 at 10:24:03AM +0100, Michael Niedermayer wrote:
> 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@niedermayer.cc>
> ---
>  libavcodec/adpcm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index edf7052636..1e23d82629 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1233,7 +1233,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;
         }