[FFmpeg-devel,1/4] avcodec/apedec: Fixes integer overflow of res+*data in do_apply_filter()

Submitted by Michael Niedermayer on Oct. 29, 2019, 10:35 p.m.

Details

Message ID 20191029223505.20667-1-michael@niedermayer.cc
State Accepted
Commit dc3f327e7403a34c88a900f0b8de55b4afd7cf6c
Headers show

Commit Message

Michael Niedermayer Oct. 29, 2019, 10:35 p.m.
Fixes: signed integer overflow: 7400 + 2147482786 cannot be represented in type 'int'
Fixes: 18405/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5708834760294400

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 Nov. 20, 2019, 2:05 p.m.
On Tue, Oct 29, 2019 at 11:35:02PM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 7400 + 2147482786 cannot be represented in type 'int'
> Fixes: 18405/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5708834760294400
> 
> 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 patchset

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 2dd197a7f2..3880e265ee 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1271,7 +1271,7 @@  static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
                                                      f->adaptcoeffs - order,
                                                      order, APESIGN(*data));
         res = (int)(res + (1U << (fracbits - 1))) >> fracbits;
-        res += *data;
+        res += (unsigned)*data;
         *data++ = res;
 
         /* Update the output history */