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

Paul B Mahol git at videolan.org
Mon May 7 23:06:24 CEST 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri May  4 12:32:43 2012 -0400| [37f4a976b374398a846b354cf16417b9a81d57e2] | committer: Luca Barbato

zerocodec: check if the previous frame is missing

ZeroCodec relies on the keyframe flag being set in the container, and
prev is the previously decoded frame. A keyframe flags incorrectly set
will lead to this condition.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

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

diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c
index 6c57e05..487cb32 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) {
+            av_log(avctx, AV_LOG_ERROR, "Missing reference frame!\n");
+            return AVERROR_INVALIDDATA;
+        }
         pic->key_frame = 0;
         pic->pict_type = AV_PICTURE_TYPE_P;
     }



More information about the ffmpeg-cvslog mailing list