mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-08-28 05:48:22 +08:00
Coding - Fix critical CodeQL static analysis warnings (#1074)
Interface_ParamSet: - Eliminate use-after-free in Append() by deleting old buffer through a temp variable after reassigning the member pointer (CodeQL #5132/#2684) delabella.cpp: - Fix upcast array pointer arithmetic by parenthesizing cast to ensure pointer arithmetic uses derived class (Vert) size rather than base class (DelaBella_Vertex) size (CodeQL #5131) NCollection_SparseArrayBase: - Rework to replace virtual dispatch (createItem/destroyItem/copyItem) with function pointers passed as arguments to protected methods - Store only DestroyItemFunc in base class to enable safe cleanup in destructor without virtual dispatch - Pass CreateItemFunc and CopyItemFunc as arguments with zero per-instance storage overhead - Move Clear() and UnsetValue() from base public API to protected clearItems()/unsetValue() with function pointer parameters; template class provides public wrappers - Remove vtable entirely (no virtual methods remain) - This eliminates the pure virtual call during base class destruction (CodeQL #5012) AdvApp2Var_MathBase: - Rewrite comparison to avoid potential signed integer overflow: *ncfnew + 1 > ncut becomes *ncfnew >= ncut (CodeQL #2692)
This commit is contained in:
@@ -535,7 +535,7 @@ int mmaper0_(integer* ncofmx,
|
||||
/* ------ Minimum that can be reached : Stop at 1 or NCFNEW ------ */
|
||||
|
||||
ncut = 1;
|
||||
if (*ncfnew + 1 > ncut)
|
||||
if (*ncfnew >= ncut)
|
||||
{
|
||||
ncut = *ncfnew + 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user