aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/sbgdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-06-24 18:57:51 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-05 23:19:39 +0200
commit09e0a122028d5bad1236fec06a736de2ceee1eed (patch)
tree260268d726b63a12c540970a24c01fb2245e6e0c /libavformat/sbgdec.c
parentbe267aa08bfb764156aa28c4e49e14cfedf1ea94 (diff)
downloadffmpeg-09e0a122028d5bad1236fec06a736de2ceee1eed.tar.gz
avformat/sbgdec: Check opt_duration and start for overflow
Fixes: signed integer overflow: 2788626175500000000 + 7118941284000000000 cannot be represented in type 'long' Fixes: 35215/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6123272247836672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 2768928624793f66694f7f2b0824f052e69e3557) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/sbgdec.c')
-rw-r--r--libavformat/sbgdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
index 9530ea42a5..55a5e27c1f 100644
--- a/libavformat/sbgdec.c
+++ b/libavformat/sbgdec.c
@@ -935,6 +935,9 @@ static int expand_timestamps(void *log, struct sbg_script *s)
}
if (s->start_ts == AV_NOPTS_VALUE)
s->start_ts = (s->opt_start_at_first && s->tseq) ? s->tseq[0].ts.t : now;
+ if (s->start_ts > INT64_MAX - s->opt_duration)
+ return AVERROR_INVALIDDATA;
+
s->end_ts = s->opt_duration ? s->start_ts + s->opt_duration :
AV_NOPTS_VALUE; /* may be overridden later by -E option */
cur_ts = now;