Skip to content

Commit

Permalink
Fix Integer Overflow at j2k.c:9614 (#1530)
Browse files Browse the repository at this point in the history
  • Loading branch information
headshog committed May 31, 2024
1 parent 1f979c5 commit 2c0823c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/openjp2/j2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -9611,6 +9611,11 @@ OPJ_BOOL opj_j2k_read_tile_header(opj_j2k_t * p_j2k,

/* Why this condition? FIXME */
if (p_j2k->m_specific_param.m_decoder.m_state & J2K_STATE_TPH) {
if (p_j2k->m_specific_param.m_decoder.m_sot_length < l_marker_size + 2) {
opj_event_msg(p_manager, EVT_ERROR,
"Sot length is less than marker size + marker ID\n");
return OPJ_FALSE;
}
p_j2k->m_specific_param.m_decoder.m_sot_length -= (l_marker_size + 2);
}
l_marker_size -= 2; /* Subtract the size of the marker ID already read */
Expand Down

0 comments on commit 2c0823c

Please sign in to comment.