Update j2k.c
This commit is contained in:
parent
ac3737372a
commit
25552ac45b
|
@ -4695,7 +4695,7 @@ static OPJ_BOOL opj_j2k_read_sod(opj_j2k_t *p_j2k,
|
|||
opj_tcp_t * l_tcp = 00;
|
||||
OPJ_UINT32 * l_tile_len = 00;
|
||||
OPJ_BOOL l_sot_length_pb_detected = OPJ_FALSE;
|
||||
|
||||
int truncate = 0;
|
||||
/* preconditions */
|
||||
assert(p_j2k != 00);
|
||||
assert(p_manager != 00);
|
||||
|
@ -4728,9 +4728,10 @@ static OPJ_BOOL opj_j2k_read_sod(opj_j2k_t *p_j2k,
|
|||
/* Check enough bytes left in stream before allocation */
|
||||
if ((OPJ_OFF_T)p_j2k->m_specific_param.m_decoder.m_sot_length >
|
||||
opj_stream_get_number_byte_left(p_stream)) {
|
||||
opj_event_msg(p_manager, EVT_ERROR,
|
||||
"Tile part length size inconsistent with stream length\n");
|
||||
return OPJ_FALSE;
|
||||
truncate = 1
|
||||
// opj_event_msg(p_manager, EVT_ERROR,
|
||||
// "Tile part length size inconsistent with stream length\n");
|
||||
// return OPJ_FALSE;
|
||||
}
|
||||
if (p_j2k->m_specific_param.m_decoder.m_sot_length >
|
||||
UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA) {
|
||||
|
@ -4804,7 +4805,7 @@ static OPJ_BOOL opj_j2k_read_sod(opj_j2k_t *p_j2k,
|
|||
|
||||
/*l_cstr_index->packno = 0;*/
|
||||
}
|
||||
|
||||
|
||||
/* Patch to support new PHR data */
|
||||
if (!l_sot_length_pb_detected) {
|
||||
l_current_read_size = opj_stream_read_data(
|
||||
|
@ -4816,7 +4817,7 @@ static OPJ_BOOL opj_j2k_read_sod(opj_j2k_t *p_j2k,
|
|||
l_current_read_size = 0;
|
||||
}
|
||||
|
||||
if (l_current_read_size != p_j2k->m_specific_param.m_decoder.m_sot_length) {
|
||||
if ((l_current_read_size != p_j2k->m_specific_param.m_decoder.m_sot_length) || (truncate > 0) ) {
|
||||
p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
|
||||
} else {
|
||||
p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT;
|
||||
|
|
Loading…
Reference in New Issue