]> git.sesse.net Git - ffmpeg/commitdiff
avformat/sbgdec: Check for timestamp overflow in parse_time_sequence()
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 19 Oct 2020 14:24:58 +0000 (16:24 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 20 Oct 2020 08:27:31 +0000 (10:27 +0200)
Fixes: signed integer overflow: 3458015007900000256 + 6425686373040000000 cannot be represented in type 'long'
Fixes: 26430/clusterfuzz-testcase-minimized-ffmpeg_dem_BRSTM_fuzzer-5761175004119040
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/sbgdec.c

index c11244ef3dfa6a64d5f2d0f9b9a163b6c123507f..4d6ae7abc567aeebccb57e6646a8ed7582467748 100644 (file)
@@ -538,6 +538,9 @@ static int parse_time_sequence(struct sbg_parser *p, int inblock)
         return AVERROR_INVALIDDATA;
     }
     ts.type = p->current_time.type;
+
+    if (av_sat_add64(p->current_time.t, rel_ts) != p->current_time.t + (uint64_t)rel_ts)
+        return AVERROR_INVALIDDATA;
     ts.t    = p->current_time.t + rel_ts;
     r = parse_fade(p, &fade);
     if (r < 0)