Skip to content

Commit

Permalink
opj_t2_encode_packet(): avoid out of bound access of uclouvain#1294, …
Browse files Browse the repository at this point in the history
…but likely not the proper fix
  • Loading branch information
rouault committed Dec 1, 2020
1 parent 2d119d0 commit fbd30b0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/openjp2/t2.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,15 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
continue;
}

/* Avoid out of bounds access of https://github.com/uclouvain/openjpeg/issues/1294 */
/* but likely not a proper fix. */
if (precno >= res->pw * res->ph) {
opj_event_msg(p_manager, EVT_ERROR,
"opj_t2_encode_packet(): accessing precno=%u >= %u\n",
precno, res->pw * res->ph);
return OPJ_FALSE;
}

prc = &band->precincts[precno];
opj_tgt_reset(prc->incltree);
opj_tgt_reset(prc->imsbtree);
Expand Down

0 comments on commit fbd30b0

Please sign in to comment.