Skip to content

Commit

Permalink
opj_j2k_setup_encoder(): validate POC compno0 (fixes #1293)
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Dec 1, 2020
1 parent 6daf5f3 commit c9380ed
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/openjp2/j2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -7945,11 +7945,18 @@ 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;
}

tcp_poc->resno0 = parameters->POC[numpocs_tile].resno0;
tcp_poc->compno0 = parameters->POC[numpocs_tile].compno0;
tcp_poc->layno1 = parameters->POC[numpocs_tile].layno1;
tcp_poc->resno1 = parameters->POC[numpocs_tile].resno1;
tcp_poc->compno1 = parameters->POC[numpocs_tile].compno1;
tcp_poc->compno1 = opj_uint_min(parameters->POC[numpocs_tile].compno1,
image->numcomps);
tcp_poc->prg1 = parameters->POC[numpocs_tile].prg1;
tcp_poc->tile = parameters->POC[numpocs_tile].tile;

Expand Down

0 comments on commit c9380ed

Please sign in to comment.