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:
Pasukhin Dmitry
2026-02-13 08:48:17 +00:00
committed by GitHub
parent 833c86f176
commit 56e162c480
6 changed files with 118 additions and 104 deletions
@@ -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;
}