From 4b70bba57ec9d61282e8b2b427d738dd44415652 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Fri, 4 May 2012 10:24:39 +0000 Subject: [PATCH] zerocodec: check if there is previous frame Fixes crash in bug #1219. Signed-off-by: Paul B Mahol --- libavcodec/zerocodec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index 02e37bc0e7..4944a3e486 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; }