j2kdec: Check curtileno for validity
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 24 Dec 2011 04:06:20 +0000 (05:06 +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 c8dabc0..4e11030 100644 (file)
@@ -427,6 +427,10 @@ static uint8_t get_sot(J2kDecoderContext *s)
         return AVERROR(EINVAL);
 
     s->curtileno = bytestream_get_be16(&s->buf); ///< Isot
+    if((unsigned)s->curtileno >= s->numXtiles * s->numYtiles){
+        s->curtileno=0;
+        return AVERROR(EINVAL);
+    }
 
     s->buf += 4; ///< Psot (ignored)