From a4ce2a98ca7c4f5fb709cddad240d5c32795a572 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 10 Apr 2010 16:19:23 +0200 Subject: [PATCH] isl_map_affine_hull: handle non-obviously empty input In particular, detect equalities before checking whether the input is empty. Otherwise, we could be accessing the first element of an empty list. --- isl_affine_hull.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/isl_affine_hull.c b/isl_affine_hull.c index ffae59c..02f1913 100644 --- a/isl_affine_hull.c +++ b/isl_affine_hull.c @@ -932,6 +932,9 @@ struct isl_basic_map *isl_map_affine_hull(struct isl_map *map) struct isl_basic_map *hull = NULL; struct isl_set *set; + map = isl_map_detect_equalities(map); + map = isl_map_align_divs(map); + if (!map) return NULL; @@ -941,10 +944,6 @@ struct isl_basic_map *isl_map_affine_hull(struct isl_map *map) return hull; } - map = isl_map_detect_equalities(map); - map = isl_map_align_divs(map); - if (!map) - return NULL; model = isl_basic_map_copy(map->p[0]); set = isl_map_underlying_set(map); set = isl_set_cow(set); -- 2.7.4