0000668: getPole() does not provide proper bound checking
This commit is contained in:
parent
0f1182e4ca
commit
85e9e013ab
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -231,6 +231,8 @@ PyObject* BezierCurvePy::getPole(PyObject * args)
|
|||
try {
|
||||
Handle_Geom_BezierCurve curve = Handle_Geom_BezierCurve::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()));
|
||||
|
@ -321,6 +323,8 @@ PyObject* BezierCurvePy::getWeight(PyObject * args)
|
|||
try {
|
||||
Handle_Geom_BezierCurve curve = Handle_Geom_BezierCurve::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);
|
||||
}
|
||||
|
|
|
@ -190,10 +190,17 @@ PyObject* BezierSurfacePy::increase(PyObject *args)
|
|||
int udegree,vdegree;
|
||||
if (!PyArg_ParseTuple(args, "ii", &udegree, &vdegree))
|
||||
return 0;
|
||||
Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
surf->Increase(udegree, vdegree);
|
||||
Py_Return;
|
||||
try {
|
||||
Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
surf->Increase(udegree, vdegree);
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
PyErr_SetString(PyExc_Exception, e->GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* BezierSurfacePy::insertPoleColAfter(PyObject *args)
|
||||
|
@ -528,6 +535,9 @@ PyObject* BezierSurfacePy::getPole(PyObject *args)
|
|||
try {
|
||||
Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
Standard_OutOfRange_Raise_if
|
||||
(uindex < 1 || uindex > surf->NbUPoles() ||
|
||||
vindex < 1 || vindex > surf->NbVPoles(), "Pole index out of range");
|
||||
gp_Pnt p = surf->Pole(uindex,vindex);
|
||||
return new Base::VectorPy(Base::Vector3d(p.X(),p.Y(),p.Z()));
|
||||
}
|
||||
|
@ -645,6 +655,9 @@ PyObject* BezierSurfacePy::getWeight(PyObject *args)
|
|||
try {
|
||||
Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user