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

Fixes null pointer dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-05-22 03:17:35 +02:00
parent 53f0442464
commit 17e66c9ff4
2 changed files with 4 additions and 0 deletions

View File

@ -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);

View File

@ -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);