From: Sven Verdoolaege Date: Fri, 6 Dec 2013 13:03:53 +0000 (+0100) Subject: isl_space_drop_dims: take into account overflow when checking indices X-Git-Tag: isl-0.12.2~2 X-Git-Url: https://repo.or.cz/w/isl.git/commitdiff_plain/fb794beb83a50148b115b17488e07db8dac9d18f isl_space_drop_dims: take into account overflow when checking indices Signed-off-by: Sven Verdoolaege --- diff --git a/isl_space.c b/isl_space.c index 864753f9..aa8a09d5 100644 --- a/isl_space.c +++ b/isl_space.c @@ -1291,7 +1291,9 @@ __isl_give isl_space *isl_space_drop_dims(__isl_take isl_space *dim, isl_die(dim->ctx, isl_error_invalid, "cannot drop dimensions of specified type", goto error); - isl_assert(dim->ctx, first + num <= n(dim, type), goto error); + if (first + num > n(dim, type) || first + num < first) + isl_die(isl_space_get_ctx(dim), isl_error_invalid, + "index out of bounds", return isl_space_free(dim)); dim = isl_space_cow(dim); if (!dim) goto error;