mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-10 09:30:48 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user