On Wed, Oct 20, 2021 at 03:03:53PM +0100, Derek Buitenhuis wrote: > It is less susceptible to overflows. > > Signed-off-by: Derek Buitenhuis <derek.buitenh...@gmail.com> > --- > libavformat/mov.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 57c67e3aac..431f430368 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -7989,12 +7989,14 @@ static int mov_read_header(AVFormatContext *s) > AVStream *st = s->streams[i]; > MOVStreamContext *sc = st->priv_data; > if (st->duration > 0) { > - if (sc->data_size > INT64_MAX / sc->time_scale / 8) { > + /* Akin to sc->data_size * 8 * sc->time_scale / st->duration > but accounting for overflows. */ > + st->codecpar->bit_rate = av_rescale(sc->data_size, > sc->time_scale * 8, st->duration);
Does something ensure time_scale * 8 fits in int ? if not this needs a cast to *int64_t thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".