j2kdec: fix division by zero, check tile dimensions for validity
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 24 Dec 2011 03:59:25 +0000 (04:59 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 24 Dec 2011 17:42:55 +0000 (18:42 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/j2kdec.c

index 1f4acc5..a8c0c52 100644 (file)
@@ -220,6 +220,9 @@ static int get_siz(J2kDecoderContext *s)
      s->tile_offset_y = bytestream_get_be32(&s->buf); // YT0Siz
        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)
         return AVERROR(EINVAL);