avcodec/jpeg2000dec: Limit poc end fields to whats available in jpeg2000_decode_packets()
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 27 Jun 2015 09:48:42 +0000 (11:48 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 27 Jun 2015 09:48:42 +0000 (11:48 +0200)
Fixes: Ticket4677

Solution based on information from
https://code.google.com/p/openjpeg/issues/detail?id=80

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

index fdacf57..68dd4c0 100644 (file)
@@ -1309,7 +1309,9 @@ static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile
             Jpeg2000POCEntry *e = &tile->poc.poc[i];
             ret = jpeg2000_decode_packets_po_iteration(s, tile,
                 e->RSpoc, e->CSpoc,
             Jpeg2000POCEntry *e = &tile->poc.poc[i];
             ret = jpeg2000_decode_packets_po_iteration(s, tile,
                 e->RSpoc, e->CSpoc,
-                e->LYEpoc, e->REpoc, e->CEpoc,
+                FFMIN(e->LYEpoc, tile->codsty[0].nlayers),
+                e->REpoc,
+                FFMIN(e->CEpoc, s->ncomponents),
                 e->Ppoc, &tp_index
                 );
             if (ret < 0)
                 e->Ppoc, &tp_index
                 );
             if (ret < 0)