mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-07 18:30:55 +03:00
0026605: Possible array out of bounds read in Extrema_GExtPC.gxx
Degenerated case fixed.
This commit is contained in:
parent
ee2038c00a
commit
1581d6511b
@ -120,7 +120,7 @@ void Extrema_GExtPC::Perform(const ThePoint& P)
|
|||||||
|
|
||||||
Standard_Integer anIdx;
|
Standard_Integer anIdx;
|
||||||
|
|
||||||
// Find first and last used knot
|
// Find first and last used knot.
|
||||||
Standard_Integer aFirstUsedKnot = aFirstIdx,
|
Standard_Integer aFirstUsedKnot = aFirstIdx,
|
||||||
aLastUsedKnot = aLastIdx;
|
aLastUsedKnot = aLastIdx;
|
||||||
for(anIdx = aFirstIdx; anIdx <= aLastIdx; anIdx++)
|
for(anIdx = aFirstIdx; anIdx <= aLastIdx; anIdx++)
|
||||||
@ -141,6 +141,16 @@ void Extrema_GExtPC::Perform(const ThePoint& P)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aFirstUsedKnot == aLastUsedKnot)
|
||||||
|
{
|
||||||
|
// Degenerated case:
|
||||||
|
// Some bounds lies out of curve param space.
|
||||||
|
// In this case build one interval with [myuinf, myusup].
|
||||||
|
// Parameters of these indexes will be redefined.
|
||||||
|
aFirstUsedKnot = aFirstIdx;
|
||||||
|
aLastUsedKnot = aFirstIdx + 1;
|
||||||
|
}
|
||||||
|
|
||||||
mysample = (TheCurveTool::BSpline(aCurve))->Degree() + 1;
|
mysample = (TheCurveTool::BSpline(aCurve))->Degree() + 1;
|
||||||
|
|
||||||
// Fill sample points.
|
// Fill sample points.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user