aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-02-10 23:21:53 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-02-20 14:21:24 +0100
commit32454c40fa657b431010d35a282276cea2389a2b (patch)
tree1c57f7a707905c5c4f1701d6662fa75d5bab53d8 /libavformat
parent12b329a51d1ab36e06d5cb42527a52b62eb52b06 (diff)
downloadffmpeg-32454c40fa657b431010d35a282276cea2389a2b.tar.gz
avformat/r3d: Check samples before computing duration
Fixes: signed integer overflow: -4611686024827895807 + -4611686016279904256 cannot be represented in type 'long' Fixes: 30161/clusterfuzz-testcase-minimized-ffmpeg_dem_R3D_fuzzer-5694406713802752 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 7a2aa5dc2af6c4fc66aaedd341b0886fbc746f0d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/r3d.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index 7aa0c5a2c3..edd80ab4fa 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -322,7 +322,8 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
pkt->stream_index = 1;
pkt->dts = dts;
- if (st->codecpar->sample_rate)
+
+ if (st->codecpar->sample_rate && samples > 0)
pkt->duration = av_rescale(samples, st->time_base.den, st->codecpar->sample_rate);
av_log(s, AV_LOG_TRACE, "pkt dts %"PRId64" duration %"PRId64" samples %d sample rate %d\n",
pkt->dts, pkt->duration, samples, st->codecpar->sample_rate);