Commit 8f615269 authored by Paul B Mahol's avatar Paul B Mahol

iff: check if there is extradata

Fixes #1368.
Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent d66b0cd5
......@@ -316,7 +316,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
int err;
if (avctx->bits_per_coded_sample <= 8) {
int palette_size = avctx->extradata_size - AV_RB16(avctx->extradata);
int palette_size;
if (avctx->extradata_size >= 2)
palette_size = avctx->extradata_size - AV_RB16(avctx->extradata);
else
palette_size = 0;
avctx->pix_fmt = (avctx->bits_per_coded_sample < 8) ||
(avctx->extradata_size >= 2 && palette_size) ? PIX_FMT_PAL8 : PIX_FMT_GRAY8;
} else if (avctx->bits_per_coded_sample <= 32) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment