Commit 17e66c9f authored by Michael Niedermayer's avatar Michael Niedermayer

j2k & jpeg2000dec: reset numX/Ytiles if tiles failed allocation

Fixes null pointer dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 53f04424
......@@ -957,6 +957,8 @@ static int decode_codestream(Jpeg2000DecoderContext *s)
switch (marker){
case JPEG2000_SIZ:
ret = get_siz(s);
if (!s->tile)
s->numXtiles = s->numYtiles = 0;
break;
case JPEG2000_COC:
ret = get_coc(s, codsty, properties);
......
......@@ -1181,6 +1181,8 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
switch (marker) {
case JPEG2000_SIZ:
ret = get_siz(s);
if (!s->tile)
s->numXtiles = s->numYtiles = 0;
break;
case JPEG2000_COC:
ret = get_coc(s, codsty, properties);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment