tilec->win_y1 = opj_uint_min(
(OPJ_UINT32)tilec->y1,
opj_uint_ceildiv(p_tcd->win_y1, image_comp->dy));
+ if (tilec->win_x1 < tilec->win_x0 ||
+ tilec->win_y1 < tilec->win_y0) {
+ /* We should not normally go there. The circumstance is when */
+ /* the tile coordinates do not intersect the area of interest */
+ /* Upper level logic should not even try to decode that tile */
+ opj_event_msg(p_manager, EVT_ERROR,
+ "Invalid tilec->win_xxx values\n");
+ return OPJ_FALSE;
+ }
for (resno = 0; resno < tilec->numresolutions; ++resno) {
opj_tcd_resolution_t *res = tilec->resolutions + resno;
}
l_data_size *= sizeof(OPJ_INT32);
- tilec->data_win = opj_image_data_alloc(l_data_size);
+ tilec->data_win = (OPJ_INT32*) opj_image_data_alloc(l_data_size);
if (tilec->data_win == NULL) {
opj_event_msg(p_manager, EVT_ERROR,
"Size of tile data exceeds system limits\n");
l_res = l_tile_comp->resolutions;
if (l_res) {
- l_nb_resolutions = l_tile_comp->resolutions_size / sizeof(opj_tcd_resolution_t);
+ l_nb_resolutions = l_tile_comp->resolutions_size / (OPJ_UINT32)sizeof(
+ opj_tcd_resolution_t);
for (resno = 0; resno < l_nb_resolutions; ++resno) {
l_band = l_res->bands;
for (bandno = 0; bandno < 3; ++bandno) {
l_precinct = l_band->precincts;
if (l_precinct) {
- l_nb_precincts = l_band->precincts_data_size / sizeof(opj_tcd_precinct_t);
+ l_nb_precincts = l_band->precincts_data_size / (OPJ_UINT32)sizeof(
+ opj_tcd_precinct_t);
for (precno = 0; precno < l_nb_precincts; ++precno) {
opj_tgt_destroy(l_precinct->incltree);
l_precinct->incltree = 00;
/* but we would need to take into account a stride then */
l_samples = (OPJ_UINT32)((res_comp0->x1 - res_comp0->x0) *
(res_comp0->y1 - res_comp0->y0));
+ if (l_tile->numcomps >= 3) {
+ if (l_tile_comp->minimum_num_resolutions !=
+ l_tile->comps[1].minimum_num_resolutions ||
+ l_tile_comp->minimum_num_resolutions !=
+ l_tile->comps[2].minimum_num_resolutions) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "Tiles don't all have the same dimension. Skip the MCT step.\n");
+ return OPJ_FALSE;
+ }
+ }
if (l_tile->numcomps >= 3) {
opj_tcd_resolution_t* res_comp1 = l_tile->comps[1].resolutions +
l_tile_comp->minimum_num_resolutions - 1;
l_code_block->numbps, l_code_block->numlenbits, l_code_block->len, l_code_block->numnewpasses, l_code_block->real_num_segs, l_code_block->m_current_max_segs );*/
- l_nb_code_blocks = p_precinct->block_size / sizeof(opj_tcd_cblk_dec_t);
+ l_nb_code_blocks = p_precinct->block_size / (OPJ_UINT32)sizeof(
+ opj_tcd_cblk_dec_t);
/*fprintf(stderr,"nb_code_blocks =%d\t}\n", l_nb_code_blocks);*/
for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
opj_tcd_cblk_enc_t * l_code_block = p_precinct->cblks.enc;
if (l_code_block) {
- l_nb_code_blocks = p_precinct->block_size / sizeof(opj_tcd_cblk_enc_t);
+ l_nb_code_blocks = p_precinct->block_size / (OPJ_UINT32)sizeof(
+ opj_tcd_cblk_enc_t);
for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
if (l_code_block->data) {