[FFmpeg-devel,5/6] avcodec/apedec: Fix integer overflow in filter_fast_3320()

Submitted by Michael Niedermayer on Aug. 17, 2019, 11:28 p.m.

Details

Message ID 20190817232841.14709-5-michael@niedermayer.cc
State Accepted
Commit 64ac8a6e697e06880e05debd5a0e47254cd8b4ca
Headers show

Commit Message

Michael Niedermayer Aug. 17, 2019, 11:28 p.m.
Fixes: signed integer overflow: -1094994793 * 2 cannot be represented in type 'int'
Fixes: 16139/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5663911036059648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/apedec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Sept. 2, 2019, 4:42 p.m.
On Sun, Aug 18, 2019 at 01:28:40AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -1094994793 * 2 cannot be represented in type 'int'
> Fixes: 16139/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5663911036059648
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/apedec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 70939abeb4..5d82ff53ff 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -828,7 +828,7 @@  static av_always_inline int filter_fast_3320(APEPredictor *p,
         return decoded;
     }
 
-    predictionA = p->buf[delayA] * 2 - p->buf[delayA - 1];
+    predictionA = p->buf[delayA] * 2U - p->buf[delayA - 1];
     p->lastA[filter] = decoded + ((int32_t)(predictionA  * p->coeffsA[filter][0]) >> 9);
 
     if ((decoded ^ predictionA) > 0)