From c7dc19d68f5de4ee150e601875d43dc80bd6c285 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 15 Apr 2012 17:41:17 +0200 Subject: [PATCH] png: make sure the previous frames dimensions match before using it as reference Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/pngdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 967d5567e8..a96d3cd5d4 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -675,7 +675,10 @@ static int decode_frame(AVCodecContext *avctx, /* handle p-frames only if a predecessor frame is available */ if(s->last_picture->data[0] != NULL) { - if(!(avpkt->flags & AV_PKT_FLAG_KEY)) { + if( !(avpkt->flags & AV_PKT_FLAG_KEY) + && s->last_picture->width == s->current_picture->width + && s->last_picture->height== s->current_picture->height + ) { int i, j; uint8_t *pd = s->current_picture->data[0]; uint8_t *pd_last = s->last_picture->data[0];