From 034e17203357a66452111a7eac0c4a2e90f39369 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 11 Aug 2010 18:25:32 +0200 Subject: [PATCH] Assert number of points in regress functions --- regress.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/regress.c b/regress.c index 238fa31..b522e43 100644 --- a/regress.c +++ b/regress.c @@ -258,6 +258,9 @@ RGR_FindBestRegression int start, nruns, npoints, npoints_left; int i; + assert(n <= MAX_POINTS); + assert(MAX_POINTS < sizeof (critical_runs10) / sizeof (critical_runs10[0])); + if (n < MIN_SAMPLES_FOR_REGRESS) { return 0; } @@ -521,6 +524,8 @@ RGR_FindBestRobustRegression double mx, dx, my, dy; int nruns = 0; + assert(n < MAX_POINTS); + if (n < 2) { return 0; } else if (n == 2) {