[FFmpeg-devel] [PATCH 08/11] avformat/mpegts: Check pcr_incr before setting bitrate

Michael Niedermayer michael at niedermayer.cc
Thu Dec 17 23:05:52 EET 2020


On Wed, Oct 28, 2020 at 11:54:16PM +0100, Marton Balint wrote:
> 
> 
> On Tue, 20 Oct 2020, Michael Niedermayer wrote:
> 
> > Fixes: division by zero
> > Fixes: 26459/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTSRAW_fuzzer-5666350112178176
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> > libavformat/mpegts.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> > index f750989629..3085371c58 100644
> > --- a/libavformat/mpegts.c
> > +++ b/libavformat/mpegts.c
> > @@ -3139,8 +3139,10 @@ static int mpegts_read_header(AVFormatContext *s)
> >         /* NOTE2: it is only the bitrate of the start of the stream */
> >         ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]);
> 
> Can't this cause division by zero as well?

i think not but the patch has another issue, iwill post a better one

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20201217/012b40fc/attachment.sig>


More information about the ffmpeg-devel mailing list