mirror of https://git.ffmpeg.org/ffmpeg.git
lavf: avoid integer overflow in ff_compute_frame_duration()
Scaling the denominator instead of the numerator if it is too large loses precision. Fixes an assert caused by a negative frame duration in the fuzzed sample nasa-8s2.ts_s202310. CC: libav-stable@libav.org
This commit is contained in:
parent
5ae72f5453
commit
7709ce029a
|
@ -725,7 +725,10 @@ void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
|
|||
*pnum = st->codec->time_base.num;
|
||||
*pden = st->codec->time_base.den;
|
||||
if (pc && pc->repeat_pict) {
|
||||
*pnum = (*pnum) * (1 + pc->repeat_pict);
|
||||
if (*pnum > INT_MAX / (1 + pc->repeat_pict))
|
||||
*pden /= 1 + pc->repeat_pict;
|
||||
else
|
||||
*pnum *= 1 + pc->repeat_pict;
|
||||
}
|
||||
//If this codec can be interlaced or progressive then we need a parser to compute duration of a packet
|
||||
//Thus if we have no parser in such case leave duration undefined.
|
||||
|
|
Loading…
Reference in New Issue