From: aml Date: Thu, 27 Aug 2015 17:24:12 +0000 (+0300) Subject: 0026605: Possible array out of bounds read in Extrema_GExtPC.gxx X-Git-Tag: V6_9_1_beta~8 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=da871fb5c9721e793e91d1cca9ecea405952fcd5;p=occt-copy.git 0026605: Possible array out of bounds read in Extrema_GExtPC.gxx Degenerated case fixed. --- diff --git a/src/Extrema/Extrema_GExtPC.gxx b/src/Extrema/Extrema_GExtPC.gxx index 59002f4f38..499aa6b663 100644 --- a/src/Extrema/Extrema_GExtPC.gxx +++ b/src/Extrema/Extrema_GExtPC.gxx @@ -118,7 +118,7 @@ void Extrema_GExtPC::Perform(const ThePoint& P) Standard_Integer anIdx; - // Find first and last used knot + // Find first and last used knot. Standard_Integer aFirstUsedKnot = aFirstIdx, aLastUsedKnot = aLastIdx; for(anIdx = aFirstIdx; anIdx <= aLastIdx; anIdx++) @@ -139,6 +139,16 @@ void Extrema_GExtPC::Perform(const ThePoint& P) 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; // Fill sample points.