aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;