[FFmpeg-devel] [PATCH v2 1/1] return value check for init_get_bits in vc1dec.c

Maryam Ebrahimzadeh me22bee at outlook.com
Sun Aug 15 10:01:26 EEST 2021


Ping.

> On Aug 13, 2021, at 1:23 AM, maryam ebrahimzadeh <me22bee at outlook.com> wrote:
> 
> ---
> libavcodec/vc1dec.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
> index 1fb1950ade..bc76a07ca6 100644
> --- a/libavcodec/vc1dec.c
> +++ b/libavcodec/vc1dec.c
> @@ -444,7 +444,9 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
>         // the last byte of the extradata is a version number, 1 for the
>         // samples we can decode
> 
> -        init_get_bits(&gb, avctx->extradata, avctx->extradata_size*8);
> +        ret = init_get_bits8(&gb, avctx->extradata, avctx->extradata_size);
> +        if (ret < 0)
> +            return ret;
> 
>         if ((ret = ff_vc1_decode_sequence_header(avctx, v, &gb)) < 0)
>           return ret;
> @@ -770,8 +772,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
>             buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2);
>         }
>         init_get_bits(&s->gb, buf2, buf_size2*8);
> -    } else
> -        init_get_bits(&s->gb, buf, buf_size*8);
> +    } else{
> +        ret = init_get_bits8(&s->gb, buf, buf_size);
> +        if (ret < 0)
> +            return ret;
> +    }
> 
>     if (v->res_sprite) {
>         v->new_sprite  = !get_bits1(&s->gb);
> -- 
> 2.17.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list