From 3a155ceda60ef29d97f4faa6dded7716af8a2ebe Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Wed, 26 Feb 2014 11:10:40 +0000 Subject: [PATCH] [trunk] Import patch from sumatrapdf team. This handle testcase 2.pdf.SIGFPE.706.1112 Update issue 225 --- src/lib/openjp2/j2k.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index 120e94fc..005698ab 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -3915,6 +3915,12 @@ OPJ_BOOL opj_j2k_read_sot ( opj_j2k_t *p_j2k, opj_read_bytes(p_header_data,&(p_j2k->m_current_tile_number),2); /* Isot */ p_header_data+=2; + /* testcase 2.pdf.SIGFPE.706.1112 */ + if (p_j2k->m_current_tile_number >= l_cp->tw * l_cp->th) { + opj_event_msg(p_manager, EVT_ERROR, "Invalid tile number %d\n", p_j2k->m_current_tile_number); + return OPJ_FALSE; + } + l_tcp = &l_cp->tcps[p_j2k->m_current_tile_number]; l_tile_x = p_j2k->m_current_tile_number % l_cp->tw; l_tile_y = p_j2k->m_current_tile_number / l_cp->tw; -- 2.40.0