vertex_cone: check that dimension is at least one
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 2 Feb 2013 09:49:50 +0000 (2 10:49 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 2 Feb 2013 18:06:25 +0000 (2 19:06 +0100)
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 <skimo@kotnet.org>
vertex_cone.cc

index 74f6bcd..c6ed581 100644 (file)
@@ -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);