Add AddressSanitizer on Windows

Description

The objective is to deploy in Windows environment AddressSanitizer test suite which is already deployed on Linux.

Code version identification

Current master branch (commit 6f375d8117a0237c4700d6976b004cee27804cbd)

Current behavior

The tools are only deployed on Linux

Expected behavior

Add the possibility for the end user to activate AddressSanitizer when compiling the library, tests and samples, as it is already done on Linux.

Security impact

This enhancement will be beneficial regarding cyber-security as it will enhance the capacity to detect vulnerabilities.

Implementation

  • Add the WITH_ASAN option in build_s2opc.bat
  • Adapt options in CommonDefs.cmake in the case "IS_MSVC", refere to official documentation for options format https://learn.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-170
  • Activate it in the Appveyor CI
  • Check that the produced binaries indeed embed the AddressSanitizer library
  • Report and fix if possible the possible bugs detected by the tool

Issue status

Enabling AddressSanitizer in the AppVeyor CI significantly slows down the compilation process, leading to test timeouts and, in some cases, a full build interruption.

I tried to use RDP access to debug the issue directly on the AppVeyor machine, but I was unable to establish the remote connection despite correctly setting up the username and password. The VM could not be accessed.

Edited by Cinthya Kouamou