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

Chris Watkins watk at google.com
Tue Jul 7 19:32:17 CEST 2015


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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-oggparsedirac-check-return-value-of-init_get_bits.patch
Type: text/x-patch
Size: 1350 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150707/f0e55fec/attachment.bin>


More information about the ffmpeg-devel mailing list