+ opj_tcd_tilecomp_t* tilec = &(p_tcd->tcd_image->tiles->comps[compno]);
+ opj_tcd_resolution_t *l_res = &
+ (tilec->resolutions[tilec->minimum_num_resolutions - 1]);
+ OPJ_UINT32 l_data_size;
+
+ /* compute l_data_size with overflow check */
+ OPJ_UINT32 res_w = (OPJ_UINT32)(l_res->x1 - l_res->x0);
+ OPJ_UINT32 res_h = (OPJ_UINT32)(l_res->y1 - l_res->y0);
+
+ /* issue 733, l_data_size == 0U, probably something wrong should be checked before getting here */
+ if (res_h > 0 && res_w > (((OPJ_UINT32) - 1) / res_h)) {
+ opj_event_msg(p_manager, EVT_ERROR, "Not enough memory for tile data\n");
+ return OPJ_FALSE;
+ }
+ l_data_size = res_w * res_h;
+
+ if ((((OPJ_UINT32) - 1) / (OPJ_UINT32)sizeof(OPJ_UINT32)) < l_data_size) {
+ opj_event_msg(p_manager, EVT_ERROR, "Not enough memory for tile data\n");
+ return OPJ_FALSE;
+ }
+ l_data_size *= (OPJ_UINT32)sizeof(OPJ_UINT32);
+
+ tilec->data_size_needed = l_data_size;
+
+ if (!opj_alloc_tile_component_data(tilec)) {