diff mbox series

[FFmpeg-devel,1/4] avformat/mov: check for pts overflow in mov_read_sidx()

Message ID 20210415204420.31613-1-michael@niedermayer.cc
State Accepted
Commit ee53bb2399d8f387ac93a18ba0600ca7b04ac634
Headers show
Series [FFmpeg-devel,1/4] avformat/mov: check for pts overflow in mov_read_sidx()
Related show

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 15, 2021, 8:44 p.m. UTC
Fixes: signed integer overflow: 9223372036846336888 + 4278255871 cannot be represented in type 'long'
Fixes: 32782/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6059216516284416

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer April 22, 2021, 1:07 p.m. UTC | #1
On Thu, Apr 15, 2021 at 10:44:17PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 9223372036846336888 + 4278255871 cannot be represented in type 'long'
> Fixes: 32782/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6059216516284416
> 
> 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 | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 43c55ef4a4..e235b2645e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5116,7 +5116,9 @@  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 + size ||
+            av_sat_add64(pts, duration) != pts + (uint64_t)duration
+        )
             return AVERROR_INVALIDDATA;
         offset += size;
         pts += duration;