j2kdec: merge length==0 check from jpeg2000
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 30 May 2013 19:01:34 +0000 (21:01 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 31 May 2013 00:22:11 +0000 (02:22 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/j2kdec.c

index 94341e1..7409525 100644 (file)
@@ -795,6 +795,10 @@ static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
     for (y = 0; y < height; y++)
         memset(t1->data[y], 0, width * sizeof(**t1->data));
 
+    /* If code-block contains no compressed data: nothing to do. */
+    if (!cblk->length)
+        return 0;
+
     for (y = 0; y < height+2; y++)
         memset(t1->flags[y], 0, (width + 2)*sizeof(**t1->flags));