From 69a25d8e50d23654e7b086986631ab26db997d17 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 2 Feb 2013 10:49:50 +0100 Subject: [PATCH] vertex_cone: check that dimension is at least one Some parts of the vertex_cone implementation assume that the dimension is at least one. Most notably, the computation of the relative coordinates in vertex_cone::init breaks down in interesting ways if the dimension is zero. Signed-off-by: Sven Verdoolaege --- vertex_cone.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vertex_cone.cc b/vertex_cone.cc index 74f6bcd..c6ed581 100644 --- a/vertex_cone.cc +++ b/vertex_cone.cc @@ -31,6 +31,8 @@ vertex_cone::vertex_cone(unsigned dim) : dim(dim) E_vertex = new evalue *[dim]; bernoulli_t = new evalue **[dim]; + assert(dim > 0); + coeff = ALLOCN(Vector *, dim); for (int i = 0; i < dim; ++i) coeff[i] = Vector_Alloc(dim); -- 2.11.4.GIT