Skip to content
This repository was archived by the owner on Mar 1, 2025. It is now read-only.

Commit e7e4103

Browse files
wwmayerchennes
authored andcommitted
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
1 parent f129997 commit e7e4103

File tree

1 file changed

+1
-1
lines changed
  • src/Mod/Sketcher/App/planegcs

1 file changed

+1
-1
lines changed

src/Mod/Sketcher/App/planegcs/Geo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ double BSpline::splineValue(double x, size_t k, unsigned int p, VEC_D& d, const
11411141
}
11421142
}
11431143

1144-
return d[p];
1144+
return p < d.size() ? d[p] : 0.0;
11451145
}
11461146

11471147
void BSpline::setupFlattenedKnots()

0 commit comments

Comments
 (0)