[FFmpeg-devel] [PATCH] oggparsedirac: check return value of init_get_bits
Clément Bœsch
u at pkh.me
Tue Apr 21 04:25:47 CEST 2015
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
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150421/17d20f22/attachment.asc>
More information about the ffmpeg-devel
mailing list