[FFmpeg-cvslog] avformat/sbgdec: Check for period overflow
Michael Niedermayer
git at videolan.org
Sun Apr 14 23:23:48 EEST 2024
ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Sat Sep 30 21:18:14 2023 +0200| [f74a82c0527db8528f9b3e9afe313d1791f606cc] | committer: Michael Niedermayer
avformat/sbgdec: Check for period overflow
Fixes: signed integer overflow: 4481246996173000000 - -4778576820000000000 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-5063670588899328
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit a9137110eda130ba07a2a43bdedff2421efbb7a9)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f74a82c0527db8528f9b3e9afe313d1791f606cc
---
libavformat/sbgdec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
index 0256a82be0..96779f71a6 100644
--- a/libavformat/sbgdec.c
+++ b/libavformat/sbgdec.c
@@ -1272,7 +1272,10 @@ static int generate_intervals(void *log, struct sbg_script *s, int sample_rate,
/* SBaGen handles the time before and after the extremal events,
and the corresponding transitions, as if the sequence were cyclic
with a 24-hours period. */
- period = s->events[s->nb_events - 1].ts - s->events[0].ts;
+ period = s->events[s->nb_events - 1].ts - (uint64_t)s->events[0].ts;
+ if (period < 0)
+ return AVERROR_INVALIDDATA;
+
period = (period + (DAY_TS - 1)) / DAY_TS * DAY_TS;
period = FFMAX(period, DAY_TS);
More information about the ffmpeg-cvslog
mailing list