Browse Source

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>
tags/n4.4
Michael Niedermayer 5 years ago
parent
commit
7a2aa5dc2a
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      libavformat/r3d.c

+ 2
- 1
libavformat/r3d.c View File

@@ -325,7 +325,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);


Loading…
Cancel
Save