diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-07-01 10:01:15 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-07-02 20:05:45 +0200 |
commit | cf04af2086be105ff86088357b83d672d38417d9 (patch) | |
tree | b0a75c9cadebc0d410e25f396bd42c7cfbe59b2a /libavcodec/jpeg2000dec.c | |
parent | b564784a207b1395d2b5a41e580539df04651096 (diff) | |
download | ffmpeg-cf04af2086be105ff86088357b83d672d38417d9.tar.gz |
jpeg2000: Check that we have enough components for MCT
Avoid overread.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/jpeg2000dec.c')
-rw-r--r-- | libavcodec/jpeg2000dec.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index d0608f97f4..2abba868a4 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -343,6 +343,13 @@ 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, AV_LOG_ERROR, + "MCT %d with too few components (%d)\n", + tmp.mct, s->ncomponents); + return AVERROR_INVALIDDATA; + } + if ((ret = get_cox(s, &tmp)) < 0) return ret; |