avcodec/jpeg2000dec: Check PPx / PPy values

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-06-24 22:58:58 +02:00
parent 08724da976
commit 2d8bf3d126

View File

@ -461,6 +461,13 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
byte = bytestream2_get_byte(&s->g);
c->log2_prec_widths[i] = byte & 0x0F; // precinct PPx
c->log2_prec_heights[i] = (byte >> 4) & 0x0F; // precinct PPy
if (i)
if (c->log2_prec_widths[i] == 0 || c->log2_prec_heights[i] == 0) {
av_log(s->avctx, AV_LOG_ERROR, "PPx %d PPy %d invalid\n",
c->log2_prec_widths[i], c->log2_prec_heights[i]);
c->log2_prec_widths[i] = c->log2_prec_heights[i] = 1;
return AVERROR_INVALIDDATA;
}
}
} else {
memset(c->log2_prec_widths , 15, sizeof(c->log2_prec_widths ));