From 5a50d18cd9c6e78b4b96fe46ec313c58f2376041 Mon Sep 17 00:00:00 2001 From: Vincent Loechner Date: Sun, 26 Feb 2012 13:11:09 +0100 Subject: [PATCH] a may bug, unlikely to happen but still: a memory read to an undefined place could happen. --- source/kernel/polyhedron.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/kernel/polyhedron.c b/source/kernel/polyhedron.c index ebc3c67..0a5a878 100644 --- a/source/kernel/polyhedron.c +++ b/source/kernel/polyhedron.c @@ -1067,9 +1067,9 @@ static Polyhedron *Remove_Redundants(Matrix *Mat,Matrix *Ray,SatMatrix *Sat,unsi if (value_cmp_si(Mat->p[i][0], NbRay) != 0) { /* Skip over inequalities and find an equality */ - for (k=i+1; value_cmp_si(Mat->p[k][0], NbRay) != 0 && k < NbConstraints; k++) + for (k=i+1; k < NbConstraints && value_cmp_si(Mat->p[k][0], NbRay) != 0 ; k++) ; - if (k==NbConstraints) /* If none found then error */ break; + if (k>=NbConstraints) /* If none found then error */ break; /* Slide inequalities down the array 'Mat' and move equality up to */ /* position 'i'. */ -- 2.11.4.GIT