From fb794beb83a50148b115b17488e07db8dac9d18f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 6 Dec 2013 14:03:53 +0100 Subject: [PATCH] isl_space_drop_dims: take into account overflow when checking indices Signed-off-by: Sven Verdoolaege --- isl_space.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.11.4.GIT