[Kst] kdeextragear-2/kst/plugins/linefit
George Staikos
staikos at kde.org
Thu Jun 12 09:10:39 CEST 2003
CVS commit by staikos:
don't access beyond the end of the array when scaling
M +5 -1 linefit.c 1.6
--- kdeextragear-2/kst/plugins/linefit/linefit.c #1.5:1.6
@@ -51,6 +51,10 @@ int linefit(const double *const inArrays
long int idx = lrint(z);
double skew = z - floor(z); /* [0..1] */
+ long int idx2 = idx + 1;
sy += inArrays[Y][i];
- sx += inArrays[X][idx] + (inArrays[X][idx+1] - inArrays[X][idx])*skew;
+ while (idx2 >= inArrayLens[Y]) {
+ idx2--;
+ }
+ sx += inArrays[X][idx] + (inArrays[X][idx2] - inArrays[X][idx])*skew;
}
More information about the Kst
mailing list