On Fri, May 04, 2012 at 10:41:47AM -0400, Derek Buitenhuis wrote:
> From: Paul B Mahol <[email protected]>
> 
> Fixes crash in bug #1219.
> 
> Signed-off-by: Paul B Mahol <[email protected]>
> ---
>  libavcodec/zerocodec.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c
> index 6c57e05..54a7e06 100644
> --- a/libavcodec/zerocodec.c
> +++ b/libavcodec/zerocodec.c
> @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, 
> void *data,
>          pic->key_frame = 1;
>          pic->pict_type = AV_PICTURE_TYPE_I;
>      } else {
> +        if (prev == NULL) {
> +            av_log(avctx, AV_LOG_ERROR, "No previous frame!\n");
> +            return AVERROR_INVALIDDATA;
> +        }
>          pic->key_frame = 0;
>          pic->pict_type = AV_PICTURE_TYPE_P;
>      }
> -- 

nit: if (!prev) looks better to me
in any case patch looks OK
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to