There are known issues when using ASAN with MFC -- Overriding operator new and delete
some Address Sanitizer Errors are not reported in VS2022 MFC project.
We can detect some Address Sanitizer Errors using cmd mode, but if we add the same code in MFC project, these errors will not be reported.
For example, if we add code “delete;” in example1.cpp file and use cmd mode to compile and debug it, it will report error of “alloc-dealloc-mismatch”. If we add the same code in one MFC project, it will NOT report errors.
I need to detect these errors in MFC project, how to solve this problem?
--------- below Address Sanitizer Errors have the similar issue ------
alloc-dealloc-mismatch
Error: alloc-dealloc-mismatch | Microsoft Learn
container-overflow
Error: container-overflow | Microsoft Learn
memcpy-param-overlap
Error: memcpy-param-overlap | Microsoft Learn
new-delete-type-mismatch