Modeling - Fix out-of-range access in BSplCLib_Reverse function (#863)

- Added a conditional check `if (aL < aUpper)` to prevent accessing array elements beyond bounds when `aL` equals or exceeds `aUpper`
This commit is contained in:
Pasukhin Dmitry
2025-11-29 21:54:09 +00:00
committed by GitHub
parent 29631c61de
commit a91a0d189a

View File

@@ -273,7 +273,10 @@ void BSplCLib_Reverse(Array& theArray, const Standard_Integer theL)
const int aL = aLower + (theL - aLower) % theArray.Length();
std::reverse(&theArray(aLower), &theArray(aL) + 1);
std::reverse(&theArray(aL + 1), &theArray(aUpper) + 1);
if (aL < aUpper)
{
std::reverse(&theArray(aL + 1), &theArray(aUpper) + 1);
}
}
// Removes a knot from the B-spline curve