diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-11-14 02:51:56 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-11-14 02:58:54 +0300 |
commit | 44a7f17d0b20e6f8d836b2957e3e357b639f19a2 (patch) | |
tree | 873cc617e3d82a8090d1e1974b0f3ff2ab3a5d40 /libavcodec | |
parent | d07585f04add2448c9a8760ba263f7ac64c910c7 (diff) |
avcodec/jpeg2000dec: Check for duplicate SIZ marker
Fixes: 0231a17345734228011c6f35a64e4594/asan_heap-oob_1d92a72_3218_1213809a9e3affec77e4c191fdfdc0a9.mov
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-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 31f3db8d68..71cb3a9240 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -1797,6 +1797,7 @@ static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s) memset(s->properties, 0, sizeof(s->properties)); memset(&s->poc , 0, sizeof(s->poc)); s->numXtiles = s->numYtiles = 0; + s->ncomponents = 0; } static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s) @@ -1854,6 +1855,10 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s) switch (marker) { case JPEG2000_SIZ: + if (s->ncomponents) { + av_log(s->avctx, AV_LOG_ERROR, "Duplicate SIZ\n"); + return AVERROR_INVALIDDATA; + } ret = get_siz(s); if (!s->tile) s->numXtiles = s->numYtiles = 0; |