diff mbox series

[FFmpeg-devel,3/4] avcodec/apedec: Fix undefined integer overflow with 24bit

Message ID 20200630202832.3672-3-michael@niedermayer.cc
State Accepted
Commit 9f7b252cdf2d0e0f79d16dc7cd575d1884239863
Headers show
Series [FFmpeg-devel,1/4] avcodec/loco: Fix integer overflow with large values from loco_get_rice()
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer June 30, 2020, 8:28 p.m. UTC
Fixes: signed integer overflow: 8683744 * 256 cannot be represented in type 'int'
Fixes: 23527/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5679885932822528

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 July 7, 2020, 4:22 p.m. UTC | #1
On Tue, Jun 30, 2020 at 10:28:31PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 8683744 * 256 cannot be represented in type 'int'
> Fixes: 23527/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5679885932822528
> 
> 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 a81767307a..c76c0509df 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1569,7 +1569,7 @@  static int ape_decode_frame(AVCodecContext *avctx, void *data,
         for (ch = 0; ch < s->channels; ch++) {
             sample24 = (int32_t *)frame->data[ch];
             for (i = 0; i < blockstodecode; i++)
-                *sample24++ = s->decoded[ch][i] * 256;
+                *sample24++ = s->decoded[ch][i] * 256U;
         }
         break;
     }