diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-06-06 16:06:13 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-06-06 16:06:48 +0200 |
commit | 21d0f75f29ca97b2ca31bd4451f488163a27e24f (patch) | |
tree | afdde64e6af4b454f5d53fcbcef5ad47a629e7db | |
parent | c49d94487c6135325930cbc4a8cd96d38ef6653e (diff) | |
download | ffmpeg-21d0f75f29ca97b2ca31bd4451f488163a27e24f.tar.gz |
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>
-rw-r--r-- | libavcodec/jpeg2000dec.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index ca4c4685a6..0f0259aa28 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -325,6 +325,11 @@ static int get_cod(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c, tmp.nlayers = bytestream2_get_be16u(&s->g); 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) return ret; |