diff mbox series

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

Message ID 20210917195616.25061-3-michael@niedermayer.cc
State Accepted
Commit 0e45886e6ea272f453cb949e95c3bfd8380974c5
Headers show
Series [FFmpeg-devel,1/4] tools/target_dec_fuzzer: Adjust VC1 threshold
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Michael Niedermayer Sept. 17, 2021, 7:56 p.m. UTC
Fixes: signed integer overflow: 2145649668 + 3956526 cannot be represented in type 'int'
Fixes: 38351/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-4647077926273024

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. 26, 2021, 3:28 p.m. UTC | #1
On Fri, Sep 17, 2021 at 09:56:15PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 2145649668 + 3956526 cannot be represented in type 'int'
> Fixes: 38351/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-4647077926273024
> 
> 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

[...]
diff mbox series

Patch

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 050523601d5..27d0ff35655 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -879,7 +879,7 @@  static av_always_inline int filter_fast_3320(APEPredictor *p,
     }
 
     predictionA = p->buf[delayA] * 2U - p->buf[delayA - 1];
-    p->lastA[filter] = decoded + ((int32_t)(predictionA  * p->coeffsA[filter][0]) >> 9);
+    p->lastA[filter] = decoded + (unsigned)((int32_t)(predictionA  * p->coeffsA[filter][0]) >> 9);
 
     if ((decoded ^ predictionA) > 0)
         p->coeffsA[filter][0]++;