Prevent NULL dereference when the palette is missing in the xan decoder.
authorLaurent Aimar <fenrir@videolan.org>
Wed, 28 Sep 2011 23:04:51 +0000 (01:04 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 1 Oct 2011 18:51:12 +0000 (20:51 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 56ee5a9ad1b385129c40ba4773f99bc5943ae8af)

libavcodec/xan.c

index 52f3a3f..b903539 100644 (file)
@@ -552,6 +552,9 @@ static int xan_decode_frame(AVCodecContext *avctx,
         }
         buf_size = buf_end - buf;
     }
+    if (s->palettes_count <= 0)
+        return AVERROR_INVALIDDATA;
+
     if ((ret = avctx->get_buffer(avctx, &s->current_frame))) {
         av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return ret;