- l_samples = (OPJ_UINT32)((
- l_tile_comp->resolutions[l_tile_comp->minimum_num_resolutions - 1].x1 -
- l_tile_comp->resolutions[l_tile_comp->minimum_num_resolutions - 1].x0) *
- (l_tile_comp->resolutions[l_tile_comp->minimum_num_resolutions - 1].y1 -
- l_tile_comp->resolutions[l_tile_comp->minimum_num_resolutions - 1].y0));
+ l_samples = (OPJ_SIZE_T)(res_comp0->x1 - res_comp0->x0) *
+ (OPJ_SIZE_T)(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;
+ opj_tcd_resolution_t* res_comp2 = l_tile->comps[2].resolutions +
+ l_tile_comp->minimum_num_resolutions - 1;
+ /* testcase 1336.pdf.asan.47.376 */
+ if (p_tcd->image->comps[0].resno_decoded !=
+ p_tcd->image->comps[1].resno_decoded ||
+ p_tcd->image->comps[0].resno_decoded !=
+ p_tcd->image->comps[2].resno_decoded ||
+ (OPJ_SIZE_T)(res_comp1->x1 - res_comp1->x0) *
+ (OPJ_SIZE_T)(res_comp1->y1 - res_comp1->y0) != l_samples ||
+ (OPJ_SIZE_T)(res_comp2->x1 - res_comp2->x0) *
+ (OPJ_SIZE_T)(res_comp2->y1 - res_comp2->y0) != l_samples) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "Tiles don't all have the same dimension. Skip the MCT step.\n");
+ return OPJ_FALSE;
+ }
+ }