[FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: Switch to init_get_bits8 and checks return value

Michael Niedermayer michael at niedermayer.cc
Wed Jul 28 20:19:12 EEST 2021


On Tue, Jul 27, 2021 at 11:25:04AM -0700, Thierry Foucu wrote:
> ---
>  libavcodec/mpeg12dec.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index b27ed5bd6d..858dca660c 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -1340,9 +1340,11 @@ static int mpeg1_decode_picture(AVCodecContext *avctx, const uint8_t *buf,
>  {
>      Mpeg1Context *s1  = avctx->priv_data;
>      MpegEncContext *s = &s1->mpeg_enc_ctx;
> -    int ref, f_code, vbv_delay;
> +    int ref, f_code, vbv_delay, ret;
>  
> -    init_get_bits(&s->gb, buf, buf_size * 8);
> +    ret = init_get_bits8(&s->gb, buf, buf_size);
> +    if (ret < 0)
> +        return ret;
>  
>      ref = get_bits(&s->gb, 10); /* temporal ref */
>      s->pict_type = get_bits(&s->gb, 3);

will apply 

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- 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/20210728/00c1e640/attachment.sig>


More information about the ffmpeg-devel mailing list