You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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>
This commit is contained in:
@@ -1797,6 +1797,7 @@ static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)
|
|||||||
memset(s->properties, 0, sizeof(s->properties));
|
memset(s->properties, 0, sizeof(s->properties));
|
||||||
memset(&s->poc , 0, sizeof(s->poc));
|
memset(&s->poc , 0, sizeof(s->poc));
|
||||||
s->numXtiles = s->numYtiles = 0;
|
s->numXtiles = s->numYtiles = 0;
|
||||||
|
s->ncomponents = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
|
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
|
||||||
@@ -1854,6 +1855,10 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
|
|||||||
|
|
||||||
switch (marker) {
|
switch (marker) {
|
||||||
case JPEG2000_SIZ:
|
case JPEG2000_SIZ:
|
||||||
|
if (s->ncomponents) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "Duplicate SIZ\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
ret = get_siz(s);
|
ret = get_siz(s);
|
||||||
if (!s->tile)
|
if (!s->tile)
|
||||||
s->numXtiles = s->numYtiles = 0;
|
s->numXtiles = s->numYtiles = 0;
|
||||||
|
Reference in New Issue
Block a user