In particular, if the computation of the last dimension overflows,
then at least one of the dimensions is out of bounds.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
if (n == 0)
return map;
+ if (first + n > isl_map_dim(map, type) || first + n < first)
+ isl_die(map->ctx, isl_error_invalid,
+ "index out of bounds", goto error);
+
map = isl_map_cow(map);
if (!map)
return NULL;
if (n == 0)
return bmap;
- if (first + n > isl_basic_map_dim(bmap, type))
+ if (first + n > isl_basic_map_dim(bmap, type) || first + n < first)
isl_die(bmap->ctx, isl_error_invalid,
"index out of bounds", goto error);