From a5203d86b36e33af6424df0f0054d4ddad9a3c4f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 30 May 2013 21:01:34 +0200 Subject: [PATCH] j2kdec: merge length==0 check from jpeg2000 Signed-off-by: Michael Niedermayer --- libavcodec/j2kdec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/j2kdec.c b/libavcodec/j2kdec.c index 94341e19bc..74095250f2 100644 --- a/libavcodec/j2kdec.c +++ b/libavcodec/j2kdec.c @@ -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));