[FFmpeg-cvslog] png: make sure the previous frames dimensions match before using it as reference

Michael Niedermayer git at videolan.org
Sun Apr 15 18:26:35 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Apr 15 17:41:17 2012 +0200| [c7dc19d68f5de4ee150e601875d43dc80bd6c285] | committer: Michael Niedermayer

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 <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c7dc19d68f5de4ee150e601875d43dc80bd6c285
---

 libavcodec/pngdec.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 967d556..a96d3cd 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];



More information about the ffmpeg-cvslog mailing list