summaryrefslogtreecommitdiff
path: root/libavcodec/xan.c
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-29 03:12:07 +0000
committerJanne Grunau <janne-libav@jannau.net>2011-10-07 17:15:31 +0200
commit7d17a794f0348ba40d5cda7d969564cb83981001 (patch)
tree7dd355eff0754be939d05204faa1760f74d17891 /libavcodec/xan.c
parent3db3fdf4c669aed9379be430c17f151d4d0697c5 (diff)
xan: Prevent NULL dereference with missing palette
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
Diffstat (limited to 'libavcodec/xan.c')
-rw-r--r--libavcodec/xan.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/xan.c b/libavcodec/xan.c
index 3965617838..54d6d15da4 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -553,6 +553,11 @@ static int xan_decode_frame(AVCodecContext *avctx,
}
buf_size = buf_end - buf;
}
+ if (s->palettes_count <= 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "No palette found\n");
+ 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;