Skip to content

Commit

Permalink
opj_j2k_setup_encoder(): validate POC compno0 and compno1 (fixes uclo…
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Dec 1, 2020
1 parent 6daf5f3 commit ece9c9b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/openjp2/j2k.c
Expand Up @@ -7945,6 +7945,17 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
if (tileno + 1 == parameters->POC[i].tile) {
opj_poc_t *tcp_poc = &tcp->pocs[numpocs_tile];

if (parameters->POC[numpocs_tile].compno0 >= image->numcomps) {
opj_event_msg(p_manager, EVT_ERROR,
"Invalid compno0 for POC %d\n", i);
return OPJ_FALSE;
}
if (parameters->POC[numpocs_tile].compno1 >= image->numcomps + 1) {
opj_event_msg(p_manager, EVT_ERROR,
"Invalid compno1 for POC %d\n", i);
return OPJ_FALSE;
}

tcp_poc->resno0 = parameters->POC[numpocs_tile].resno0;
tcp_poc->compno0 = parameters->POC[numpocs_tile].compno0;
tcp_poc->layno1 = parameters->POC[numpocs_tile].layno1;
Expand Down

0 comments on commit ece9c9b

Please sign in to comment.