Sketch: Fix possible crash in BSpline::splineValue

There is an underflow of an unsigned int in the calling instance that sets the parameter 'p' to 2**32-1.
But the size of the passed vector is 0. To fix the crash first check if p is less then the size of the vector.

See: https://forum.freecad.org/viewtopic.php?t=92815
This commit is contained in:
wmayer
2024-12-09 11:05:14 +01:00
committed by Chris Hennes
parent f12999724b
commit e7e410323e

View File

@@ -1141,7 +1141,7 @@ double BSpline::splineValue(double x, size_t k, unsigned int p, VEC_D& d, const
}
}
return d[p];
return p < d.size() ? d[p] : 0.0;
}
void BSpline::setupFlattenedKnots()