avcodec/jpeg2000dec: Check that coords match before applying ICT

This avoid potential out of array accesses

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 12ba1b2b4d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-06-09 00:37:26 +02:00 committed by Michael Niedermayer
parent 8fc8b3eebe
commit 84cf741861
1 changed files with 6 additions and 1 deletions

View File

@ -1162,11 +1162,16 @@ static void mct_decode(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
int32_t *src[3], i0, i1, i2;
float *srcf[3], i0f, i1f, i2f;
for (i = 1; i < 3; i++)
for (i = 1; i < 3; i++) {
if (tile->codsty[0].transform != tile->codsty[i].transform) {
av_log(s->avctx, AV_LOG_ERROR, "Transforms mismatch, MCT not supported\n");
return;
}
if (memcmp(tile->comp[0].coord, tile->comp[i].coord, sizeof(tile->comp[0].coord))) {
av_log(s->avctx, AV_LOG_ERROR, "Coords mismatch, MCT not supported\n");
return;
}
}
for (i = 0; i < 3; i++)
if (tile->codsty[0].transform == FF_DWT97)