[FFmpeg-devel] [PATCH] avformat/mpeg: Check avio_read() return value in get_pts()

Michael Niedermayer michael at niedermayer.cc
Sun Aug 16 21:12:20 EEST 2020


On Fri, Aug 14, 2020 at 04:50:02PM -0700, Thierry Foucu wrote:
> On Fri, Aug 14, 2020, 4:08 PM Michael Niedermayer <michael at niedermayer.cc>
> wrote:
> 
> > Found-by: Thierry Foucu <tfoucu at gmail.com>
> > Fixes: Use-of-uninitialized-value
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavformat/mpeg.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
> > index 265b2bd1ad..a5e17925ce 100644
> > --- a/libavformat/mpeg.c
> > +++ b/libavformat/mpeg.c
> > @@ -147,9 +147,12 @@ static int mpegps_read_header(AVFormatContext *s)
> >  static int64_t get_pts(AVIOContext *pb, int c)
> >  {
> >      uint8_t buf[5];
> > +    int ret;
> >
> >      buf[0] = c < 0 ? avio_r8(pb) : c;
> > -    avio_read(pb, buf + 1, 4);
> > +    ret = avio_read(pb, buf + 1, 4);
> > +    if (ret < 4)
> > +        return AV_NOPTS_VALUE;
> >
> >      return ff_parse_pes_pts(buf);
> >  }
> > --
> > 2.17.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 
> 
> 
> 
> 
> Thanks.
> 
> I though also about this solution. This works as well.

will apply

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- 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/20200816/582bbdab/attachment.sig>


More information about the ffmpeg-devel mailing list