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

@@ -751,6 +751,9 @@ PyObject* BSplineSurfacePy::getPole(PyObject *args)
try {
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
(getGeometryPtr()->handle());
Standard_OutOfRange_Raise_if
(uindex < 1 || uindex > surf->NbUPoles() ||
vindex < 1 || vindex > surf->NbVPoles(), "Pole index out of range");
gp_Pnt pnt = surf->Pole(uindex,vindex);
Base::VectorPy* vec = new Base::VectorPy(Base::Vector3d(
pnt.X(), pnt.Y(), pnt.Z()));
@@ -870,6 +873,9 @@ PyObject* BSplineSurfacePy::getWeight(PyObject *args)
try {
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
(getGeometryPtr()->handle());
Standard_OutOfRange_Raise_if
(uindex < 1 || uindex > surf->NbUPoles() ||
vindex < 1 || vindex > surf->NbVPoles(), "Weight index out of range");
double w = surf->Weight(uindex,vindex);
return Py_BuildValue("d", w);
}