Prevent NULL dereference when the palette is missing in the xan decoder.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Laurent Aimar 2011-09-29 01:04:51 +02:00 committed by Michael Niedermayer
parent 5279141c1d
commit 56ee5a9ad1
1 changed files with 3 additions and 0 deletions

View 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;