mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-08-14 12:39:17 +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:
@@ -247,7 +247,7 @@ struct CDelaBella : IDelaBella
|
||||
errlog_proc(errlog_file,
|
||||
"[WRN] all input points are colinear, returning single segment!\n");
|
||||
first_hull_vert = vert_alloc + 0;
|
||||
vert_alloc[0].next = (DelaBella_Vertex*)vert_alloc + 1;
|
||||
vert_alloc[0].next = (DelaBella_Vertex*)(vert_alloc + 1);
|
||||
vert_alloc[1].next = nullptr;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user