avcodec/jpeg2000dec: Check reslevelno in RPCL
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 15 Jun 2015 01:00:53 +0000 (03:00 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 15 Jun 2015 01:00:53 +0000 (03:00 +0200)
Fixes out of array read
Fixes Ticket4627

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/jpeg2000dec.c

index d5abc42..d00ef10 100644 (file)
@@ -1102,6 +1102,9 @@ static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile
                         int xc = x / s->cdx[compno];
                         int yc = y / s->cdy[compno];
 
+                        if (reslevelno >= codsty->nreslevels)
+                            continue;
+
                         if (yc % (1 << (rlevel->log2_prec_height + reducedresno)))
                             continue;