aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-14 00:51:56 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-14 01:11:00 +0100
commit3300005351e7153caa4e59f960bb2b9a18f877b3 (patch)
treed7eaabda9da5e94cbe561150d73ebd79b6792e4a
parent4eb67f3ddccacc03312b8dea06dd35e24411d16c (diff)
downloadffmpeg-3300005351e7153caa4e59f960bb2b9a18f877b3.tar.gz
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> (cherry picked from commit 44a7f17d0b20e6f8d836b2957e3e357b639f19a2) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/jpeg2000dec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 444a731623..04f94234d8 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1400,6 +1400,7 @@ static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)
memset(s->codsty, 0, sizeof(s->codsty));
memset(s->qntsty, 0, sizeof(s->qntsty));
s->numXtiles = s->numYtiles = 0;
+ s->ncomponents = 0;
}
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
@@ -1454,6 +1455,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;