]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Assert number of points in regress functions
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 11 Aug 2010 16:25:32 +0000 (18:25 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 11 Aug 2010 16:25:32 +0000 (18:25 +0200)
regress.c

index 238fa317e5df447f26eb21d9d895ad5d136622a0..b522e43b0e6fe73c87778d4cbc07fc2025d1334c 100644 (file)
--- 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) {