0000668: getPole() does not provide proper bound checking

This commit is contained in:
wmayer
2012-04-12 13:24:48 +02:00
parent a8d7fe27e8
commit 2edd283f4b
4 changed files with 31 additions and 4 deletions

View File

@@ -393,6 +393,8 @@ PyObject* BSplineCurvePy::getPole(PyObject * args)
try {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
Standard_OutOfRange_Raise_if
(index < 1 || index > curve->NbPoles(), "Pole index out of range");
gp_Pnt pnt = curve->Pole(index);
Base::VectorPy* vec = new Base::VectorPy(Base::Vector3d(
pnt.X(), pnt.Y(), pnt.Z()));
@@ -457,6 +459,8 @@ PyObject* BSplineCurvePy::getWeight(PyObject * args)
try {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
Standard_OutOfRange_Raise_if
(index < 1 || index > curve->NbPoles() , "Weight index out of range");
double weight = curve->Weight(index);
return Py_BuildValue("d", weight);
}