opj_j2k_decode_tile(): avoid 'Stream too short' error in non-strict mode

This commit is contained in:
Even Rouault 2022-02-10 15:49:57 +01:00
parent 3837ff1b1a
commit 6a29f5a9e3
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D
1 changed files with 3 additions and 3 deletions

View File

@ -9901,10 +9901,10 @@ OPJ_BOOL opj_j2k_decode_tile(opj_j2k_t * p_j2k,
if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) { if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
if (opj_stream_read_data(p_stream, l_data, 2, p_manager) != 2) { if (opj_stream_read_data(p_stream, l_data, 2, p_manager) != 2) {
opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n"); opj_event_msg(p_manager, p_j2k->m_cp.strict ? EVT_ERROR : EVT_WARNING,
return OPJ_FALSE; "Stream too short\n");
return p_j2k->m_cp.strict ? OPJ_FALSE : OPJ_TRUE;
} }
opj_read_bytes(l_data, &l_current_marker, 2); opj_read_bytes(l_data, &l_current_marker, 2);
if (l_current_marker == J2K_MS_EOC) { if (l_current_marker == J2K_MS_EOC) {