summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2014-02-28 15:24:33 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2014-02-28 15:24:33 +0000
commitfd5f21af0077d59160cdab83e5ea01022313ca5e (patch)
treece9878e85c5f216f76c4dfccce60076847997bd2 /src/lib
parent1b93cb8c0a0f613a3c87d00a373c36b036e83b8b (diff)
[trunk] Rework r2458, instead we should reject 451.pdf.SIGSEGV.ce9.3723 since tile-parts are out of order (as per kakadu behavior).
Update issue 225
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/openjp2/j2k.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c
index bd39f759..9637b552 100644
--- a/src/lib/openjp2/j2k.c
+++ b/src/lib/openjp2/j2k.c
@@ -4010,12 +4010,20 @@ OPJ_BOOL opj_j2k_read_sot ( opj_j2k_t *p_j2k,
if (l_num_parts != 0) { /* Number of tile-part header is provided by this tile-part header */
/* Useful to manage the case of textGBR.jp2 file because two values of TNSot are allowed: the correct numbers of
* tile-parts for that tile and zero (A.4.2 of 15444-1 : 2002). */
- if (l_num_parts < l_tcp->m_nb_tile_parts) {
- l_num_parts = l_tcp->m_nb_tile_parts;
+ if (l_tcp->m_nb_tile_parts) {
+ if (l_current_part >= l_tcp->m_nb_tile_parts){
+ opj_event_msg(p_manager, EVT_ERROR, "In SOT marker, TPSot (%d) is not valid regards to the current "
+ "number of tile-part (%d), giving up\n", l_current_part, l_tcp->m_nb_tile_parts );
+ p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
+ return OPJ_FALSE;
+ }
}
- if (l_current_part >= l_num_parts) {
- /* testcase 451.pdf.SIGSEGV.ce9.3723 */
- l_num_parts = l_current_part + 1;
+ if( l_current_part >= l_num_parts ) {
+ /* testcase 451.pdf.SIGSEGV.ce9.3723 */
+ opj_event_msg(p_manager, EVT_ERROR, "In SOT marker, TPSot (%d) is not valid regards to the current "
+ "number of tile-part (header) (%d), giving up\n", l_current_part, l_num_parts );
+ p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
+ return OPJ_FALSE;
}
l_tcp->m_nb_tile_parts = l_num_parts;
}