[FFmpeg-devel] [PATCH] oggparsedirac: check return value of init_get_bits

Michael Niedermayer michaelni at gmx.at
Thu Jul 9 05:28:04 CEST 2015


On Tue, Jul 07, 2015 at 05:32:17PM +0000, Chris Watkins wrote:
> On Mon, Apr 20, 2015 at 7:25 PM Clément Bœsch <u at pkh.me> wrote:
> 
> > On Mon, Apr 20, 2015 at 02:29:54PM -0700, Christopher Watkins wrote:
> > >
> >
> > > From a93fa19467ac2568cfe32332b789b315e37dbdf1 Mon Sep 17 00:00:00 2001
> > > From: Chris Watkins <watk at chromium.org>
> > > Date: Mon, 20 Apr 2015 14:23:57 -0700
> > > Subject: [PATCH] oggparsedirac: check return value of init_get_bits
> > >
> > > If init_get_bits fails the GetBitContext is invalid and must not be
> > > used. Check the return value in dirac_header and propogate the error.
> > >
> > > Signed-off-by: Chris Watkins <watk at chromium.org>
> > > ---
> > >  libavformat/oggparsedirac.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavformat/oggparsedirac.c b/libavformat/oggparsedirac.c
> > > index 10fb07e..35be655 100644
> > > --- a/libavformat/oggparsedirac.c
> > > +++ b/libavformat/oggparsedirac.c
> > > @@ -36,7 +36,9 @@ static int dirac_header(AVFormatContext *s, int idx)
> > >      if (st->codec->codec_id == AV_CODEC_ID_DIRAC)
> > >          return 0;
> > >
> > > -    init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);
> > > +    if (init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13)
> > * 8) < 0)
> > > +        return -1;
> >
> > int ret;
> > // ...
> > ret = init_get_bits(...);
> > if (ret < 0)
> >   return ret;
> >
> > You can also use init_get_bits8() while at it
> >
> 
> Thanks, done. I also used this pattern for the following call to
> avpriv_dirac_parse_sequence_header too. Sorry for the delay.
> 
> 
> >
> > --
> > Clément B.
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >

>  oggparsedirac.c |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> da246725f28ee17366c568d2def1ccd2f376cbce  0001-oggparsedirac-check-return-value-of-init_get_bits.patch
> From 4ec8999352db4af876d521d12d8d387ba278a127 Mon Sep 17 00:00:00 2001
> From: Chris Watkins <watk at chromium.org>
> Date: Tue, 7 Jul 2015 10:23:44 -0700
> Subject: [PATCH] oggparsedirac: check return value of init_get_bits

applied

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150709/c3064b45/attachment.sig>


More information about the ffmpeg-devel mailing list