[Kst] kdeextragear-2/kst/plugins/linefit
George Staikos
staikos at kde.org
Thu Jun 12 09:19:08 CEST 2003
CVS commit by staikos:
another access beyond the end of the array while interpolating.
M +8 -2 linefit.c 1.7
--- kdeextragear-2/kst/plugins/linefit/linefit.c #1.6:1.7
@@ -81,6 +81,12 @@ int linefit(const double *const inArrays
long int idx = lrint(z);
double skew = z - floor(z); /* [0..1] */
- double newX = inArrays[X][idx] + (inArrays[X][idx+1] - inArrays[X][idx])*skew;
- double ci = inArrays[Y][i] - a - b*newX;
+ long int idx2 = idx + 1;
+ double newX;
+ double ci;
+ while (idx2 >= inArrayLens[X]) {
+ idx2--;
+ }
+ newX = inArrays[X][idx] + (inArrays[X][idx+1] - inArrays[X][idx])*skew;
+ ci = inArrays[Y][i] - a - b*newX;
chi2 += ci*ci;
}
More information about the Kst
mailing list