j2kdec: fix division by zero, check tile dimensions for validity

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-12-24 04:59:25 +01:00
parent 58c41799ab
commit 628c9dcca3
1 changed files with 3 additions and 0 deletions

View File

@ -220,6 +220,9 @@ static int get_siz(J2kDecoderContext *s)
s->tile_offset_y = bytestream_get_be32(&s->buf); // YT0Siz s->tile_offset_y = bytestream_get_be32(&s->buf); // YT0Siz
s->ncomponents = bytestream_get_be16(&s->buf); // CSiz s->ncomponents = bytestream_get_be16(&s->buf); // CSiz
if(s->tile_width<=0 || s->tile_height<=0)
return AVERROR(EINVAL);
if (s->buf_end - s->buf < 2 * s->ncomponents) if (s->buf_end - s->buf < 2 * s->ncomponents)
return AVERROR(EINVAL); return AVERROR(EINVAL);