while ((data + 4) <= eod) {
chunk_id = BE_16 (&data[0]);
chunk_size = BE_16 (&data[2]) - 4;
+ if(chunk_size < 0)
+ return -1;
+
data += 4;
chunk_size = ((data + chunk_size) > eod) ? (eod - data) : chunk_size;
s->height = (avctx->height + 3) & ~3;
// check for paletted data
- if (avctx->palctrl == NULL) {
+ if ((avctx->palctrl == NULL) || (avctx->bits_per_sample == 40)) {
s->palette_video = 0;
avctx->pix_fmt = PIX_FMT_YUV420P;
} else {