jpeg2000dec: Check compno in get_coc()

Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-06-14 01:54:30 +02:00
parent 852f74bd85
commit e850a064ce

View File

@ -354,6 +354,11 @@ static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
compno = bytestream2_get_byteu(&s->g);
if (compno >= s->ncomponents) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid compno %d\n", compno);
return AVERROR_INVALIDDATA;
}
c += compno;
c->csty = bytestream2_get_byteu(&s->g);