Skip to content

L2SS-1125: Resolve issues on arm hardfloat platform using 64bits debian

Corné Lukken requested to merge L2SS-1125 into master

The opcua server codebase was subject to several memory leaks including stack use after free and heap overflows. These have caused quite a ghost chase about probably causes leading to the suspicion that the open62541 library was to blame. Further investigations with address sanitizer let to the discovery of these errors.

In this patch the opcua server codebase is rewritten to remove any memory errors. In addition the variable registration has been updated to a templated method reducing about 600 lines of duplicate code. Lastly, a job has been added to the CI/CD pipeline that compiles and runs the program and asserts that no memory leaks are found.

Leak tests can be performed manually at leisure by adding the makeflags -g3 -fsanitize=address -fno-omit-frame-pointer.

To conclude:

  1. Removing the -O3 parameter from the makeflags is not necessary
  2. Compiling and linking open62541 as shared library is not necessary
  3. More care is needed to prevent coding memory errors.
  4. The opcua add_variable methods have been reduced to a single templated method
  5. A CI/CD job to assert the absence of memory leaks has been added.

Closes L2SS-1125

Edited by Corné Lukken

Merge request reports