jpeg2000dec: check that we have enough components for MCT
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:
parent
c49d94487c
commit
21d0f75f29
@ -325,6 +325,11 @@ static int get_cod(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
|
|||||||
tmp.nlayers = bytestream2_get_be16u(&s->g);
|
tmp.nlayers = bytestream2_get_be16u(&s->g);
|
||||||
tmp.mct = bytestream2_get_byteu(&s->g); // multiple component transformation
|
tmp.mct = bytestream2_get_byteu(&s->g); // multiple component transformation
|
||||||
|
|
||||||
|
if (tmp.mct && s->ncomponents < 3) {
|
||||||
|
av_log(s->avctx, "MCT %d with too few components (%d)\n", tmp.mct, s->ncomponents);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
if ((ret = get_cox(s, &tmp)) < 0)
|
if ((ret = get_cox(s, &tmp)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user