diff mbox series

[FFmpeg-devel,3/4] avformat/mov: Fix incorrect overflow detection in mov_read_sidx()

Message ID 20210428150636.28396-3-michael@niedermayer.cc
State Accepted
Commit 200406d930eff3202f3230f188f85f4ab9cf4525
Headers show
Series [FFmpeg-devel,1/4] avformat/mvdec: Check sample rate in parse_audio_var() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer April 28, 2021, 3:06 p.m. UTC
Fixes: signed integer overflow: 9223372036854775807 + 1442840321 cannot be represented in type 'long'
Fixes: 33670/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644379491106816

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

Comments

Michael Niedermayer July 28, 2021, 5:20 p.m. UTC | #1
On Wed, Apr 28, 2021 at 05:06:35PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 9223372036854775807 + 1442840321 cannot be represented in type 'long'
> Fixes: 33670/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644379491106816
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index ca8f06c4cd..0f94abd040 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5080,7 +5080,7 @@  static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         if (frag_stream_info)
             frag_stream_info->sidx_pts = timestamp;
 
-        if (av_sat_add64(offset, size) != offset + size ||
+        if (av_sat_add64(offset, size) != offset + (uint64_t)size ||
             av_sat_add64(pts, duration) != pts + (uint64_t)duration
         )
             return AVERROR_INVALIDDATA;