Commit ddd89740 authored by Piotr Bandurski's avatar Piotr Bandurski Committed by Michael Niedermayer

iff: prevent a possible crash with broken/prepared IFF PBM

Based on fix by Peter Ross for ticket #1054.
Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent aebce0b0
......@@ -553,13 +553,16 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
memcpy(row, buf, FFMIN(avctx->width, buf_end - buf));
buf += avctx->width + (avctx->width % 2); // padding if odd
}
} else { // IFF-PBM: HAM to PIX_FMT_BGR32
} else if (s->ham) { // IFF-PBM: HAM to PIX_FMT_BGR32
for (y = 0; y < avctx->height; y++) {
uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];
memcpy(s->ham_buf, buf, FFMIN(avctx->width, buf_end - buf));
buf += avctx->width + (avctx->width & 1); // padding if odd
decode_ham_plane32((uint32_t *) row, s->ham_buf, s->ham_palbuf, s->planesize);
}
} else {
av_log_ask_for_sample(avctx, "unsupported bpp\n");
return AVERROR_INVALIDDATA;
}
}
......
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