From 56ee5a9ad1b385129c40ba4773f99bc5943ae8af Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Thu, 29 Sep 2011 01:04:51 +0200 Subject: Prevent NULL dereference when the palette is missing in the xan decoder. Signed-off-by: Michael Niedermayer --- libavcodec/xan.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libavcodec/xan.c') diff --git a/libavcodec/xan.c b/libavcodec/xan.c index 51b4b958b2..fe11ac3f7a 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -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; -- cgit v1.2.3