From: Mathieu Malaterre Date: Wed, 26 Feb 2014 11:25:27 +0000 (+0000) Subject: [trunk] Import patch from sumatrapdf team. This handle testcase 1851.pdf.SIGSEGV... X-Git-Tag: version.2.0.1~4^2~209 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=37a8d2acc1945010fc4b76255003d1f9e9edefa8;p=openjpeg [trunk] Import patch from sumatrapdf team. This handle testcase 1851.pdf.SIGSEGV.ce9.948 Update issue 225 --- diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c index 978f3c57..544ce91b 100644 --- a/src/lib/openjp2/jp2.c +++ b/src/lib/openjp2/jp2.c @@ -1819,6 +1819,12 @@ OPJ_BOOL opj_jp2_read_header_procedure( opj_jp2_t *jp2, opj_free(l_current_data); return OPJ_FALSE; } + /* testcase 1851.pdf.SIGSEGV.ce9.948 */ + else if (box.length < l_nb_bytes_read) { + opj_event_msg(p_manager, EVT_ERROR, "invalid box size %d (%x)\n", box.length, box.type); + opj_free(l_current_data); + return OPJ_FALSE; + } l_current_handler = opj_jp2_find_handler(box.type); l_current_data_size = box.length - l_nb_bytes_read;