changeset 9918:de14016e0b2d libavcodec

Check that palctrl is available on init instead of crashing when trying to use it on decode. Fixes mpeg2/smclockmpeg2.avi.2.1 from issue 1240.
author reimar
date Sun, 05 Jul 2009 12:14:05 +0000
parents 2e8083f6524e
children c7c1c6b35a73
files qpeg.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/qpeg.c	Sat Jul 04 23:59:10 2009 +0000
+++ b/qpeg.c	Sun Jul 05 12:14:05 2009 +0000
@@ -289,6 +289,10 @@
 static av_cold int decode_init(AVCodecContext *avctx){
     QpegContext * const a = avctx->priv_data;
 
+    if (!avctx->palctrl) {
+        av_log(avctx, AV_LOG_FATAL, "Missing required palette via palctrl\n");
+        return -1;
+    }
     a->avctx = avctx;
     avctx->pix_fmt= PIX_FMT_PAL8;
     a->refdata = av_malloc(avctx->width * avctx->height);