Commit 2d8bf3d1 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/jpeg2000dec: Check PPx / PPy values

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 08724da9
......@@ -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 ));
......
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