On Fri, 15 Jul 2011 01:29:27 +0200, Diego Biurrun <[email protected]> wrote:
> User-provided data should never trigger an assert; also fixes the warning:
> libavcodec/vaapi_mpeg2.c:112:14: warning: variable 'start_code' set but not 
> used
> ---
>  libavcodec/vaapi_mpeg2.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
> index 561f4bf..cb22c44 100644
> --- a/libavcodec/vaapi_mpeg2.c
> +++ b/libavcodec/vaapi_mpeg2.c
> @@ -116,7 +116,8 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext 
> *avctx, const uint8_t *buffer
>      /* Determine macroblock_offset */
>      init_get_bits(&gb, buffer, 8 * size);
>      start_code = get_bits(&gb, 32);
> -    assert((start_code & 0xffffff00) == 0x00000100);
> +    if (!((start_code & 0xffffff00) == 0x00000100))
> +        return -1;

AVERROR_INVALIDDATA

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to