On 2014-01-06 08:36:42 +0100, Anton Khirnov wrote:
> Prevents using GetBitContexts with data from previous calls.
> 
> Fixes access to freed memory.
> 
> Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> CC:[email protected]
> ---
>  libavcodec/h264.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index d43b11e..ad73bb3 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -4899,6 +4899,9 @@ static int h264_decode_frame(AVCodecContext *avctx, 
> void *data,
>      int ret;
>  
>      h->flags = avctx->flags;
> +    /* reset data partitioning here, to ensure GetBitContexts from previous
> +     * packets do not get used. */
> +    h->data_partitioning = 0;
>  
>      /* end of stream, output what is still in the buffers */
>  out:

This breaks data_partioning and (avctx->flags2 & CODEC_FLAG2_CHUNKS).
I'm not actually sure if it currently works and it's a case we should
support but when we break it intentionally why should add a warning and
error out when we encouter data partioning with CODEC_FLAG2_CHUNKS set.

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

Reply via email to