What AddressSanitizer flags should I use to detect more errors?

3.5k views Asked by At

What Asan flags should I use to detect more errors? At the moment, I use ASAN_OPTIONS=detect_stack_use_after_return=1.

2

There are 2 answers

0
yugr On

From Asan FAQ:

Q: Can I run AddressSanitizer with more aggressive diagnostics enabled?

A: Yes! In particular you may want to enable

  CFLAGS += -fsanitize-address-use-after-scope
  ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1

Check https://github.com/google/sanitizers/wiki/AddressSanitizerFlags for more details on this.
0
Jon marsh On

In command line add these options when compiling :

-fsanitize-recover=address -fsanitize=address

When running the executables add these options :

ASAN_OPTIONS=halt_on_error=0 ./your_executable_name

These Options I tried On Ubuntu,In Windows I am still finding answer.