summaryrefslogtreecommitdiff
path: root/openjpeg
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-11-15 15:06:58 +0000
committerRobin Watts <robin.watts@artifex.com>2016-11-15 15:08:25 +0000
commit99e9ca317adbd28b5faf3e9eda4c63d636478f43 (patch)
tree1e37105aa0769bbb7f33cd2c4deb13f3cc80dd82 /openjpeg
parent2f6ddae95676585717159445001fda2ebb00db8d (diff)
downloadghostpdl-99e9ca317adbd28b5faf3e9eda4c63d636478f43.tar.gz
Bug 697045: Skip over broken tile data rather than aborting.
Diffstat (limited to 'openjpeg')
-rw-r--r--openjpeg/src/lib/openjp2/j2k.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/openjpeg/src/lib/openjp2/j2k.c b/openjpeg/src/lib/openjp2/j2k.c
index de6fba409..7c0696838 100644
--- a/openjpeg/src/lib/openjp2/j2k.c
+++ b/openjpeg/src/lib/openjp2/j2k.c
@@ -4145,12 +4145,22 @@ static OPJ_BOOL opj_j2k_read_sot ( opj_j2k_t *p_j2k,
/* 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_tcp->m_nb_tile_parts) {
+#ifdef TILE_ERRORS_ARE_FATAL
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;
}
+#else
+ if (l_current_part >= l_tcp->m_nb_tile_parts){
+ opj_event_msg(p_manager, EVT_WARNING, "In SOT marker, TPSot (%d) is not valid regards to the current "
+ "number of tile-part (%d), skipping\n", l_current_part, l_tcp->m_nb_tile_parts );
+ p_j2k->m_specific_param.m_decoder.m_sot_length = l_tot_len - 12;
+ p_j2k->m_specific_param.m_decoder.m_skip_data = 1;
+ return OPJ_TRUE;
+ }
+#endif
}
/* cf. https://code.google.com/p/openjpeg/issues/detail?id=254 */
if (++l_num_parts < l_tcp->m_nb_tile_parts) {