[FFmpeg-cvslog] zerocodec: check if there is previous frame

Paul B Mahol git at videolan.org
Fri May 4 12:44:39 CEST 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri May  4 10:24:39 2012 +0000| [4b70bba57ec9d61282e8b2b427d738dd44415652] | committer: Paul B Mahol

zerocodec: check if there is previous frame

Fixes crash in bug #1219.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

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

diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c
index 02e37bc..4944a3e 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;
     }



More information about the ffmpeg-cvslog mailing list