diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-06-14 01:54:30 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-06-14 01:55:43 +0200 |
commit | e850a064cee3c291d8e122a6284bb0ea1a59787f (patch) | |
tree | f29afd4382111c504eb61c4bdae2b18f47ce11f3 | |
parent | 852f74bd859da374898d865502576bd5e7a75f48 (diff) | |
download | ffmpeg-e850a064cee3c291d8e122a6284bb0ea1a59787f.tar.gz |
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>
-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 87a1d58e77..b856db4b22 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -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); |