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 <w...@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 <w...@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 -- Clément B.
pgpdUcQxdsvmj.pgp
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel