jpeg2000dec: Add more checks when parsing headers
authorMartin Storsjö <martin@martin.st>
Mon, 16 Sep 2013 13:17:05 +0000 (16:17 +0300)
committerMartin Storsjö <martin@martin.st>
Tue, 17 Sep 2013 12:57:27 +0000 (15:57 +0300)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/jpeg2000dec.c

index 61befdf..18346f9 100644 (file)
@@ -1284,6 +1284,10 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
                 av_log(s->avctx, AV_LOG_ERROR, "Missing SOT\n");
                 return AVERROR_INVALIDDATA;
             }
+            if (!s->tile) {
+                av_log(s->avctx, AV_LOG_ERROR, "Missing SIZ\n");
+                return AVERROR_INVALIDDATA;
+            }
 
             tile = s->tile + s->curtileno;
             tp = tile->tile_part + tile->tp_idx;