Questions tagged [address-sanitizer]

AddressSanitizer (ASAN) is a fast memory error detector for issues such as out-of-bounds access and more.

AddressSanitizer (ASAN) is a fast memory error detector and consists of compile time instrumentation and a runtime library.

See also:

530 questions
6
votes
1 answer

ASAN heap use after free

I am running ASAN for finding memory leaks in a very big project. I have found out the cause, but do not know how to resolve it. I have made a sample program to make the problem understandable. In the below program I can only work-around on…
Sanjay
  • 83
  • 1
  • 1
  • 4
6
votes
1 answer

AddressSanitizer blacklist in c++ not working

I'm trying to get address sanitizer blacklist working in a C++ project but its not working as expected. I tried the example on their website, if I compile with clang, it works fine. build % cat suppress.txt fun:bad_foo build % cat foo.c #include…
Tareq A. Siraj
  • 424
  • 3
  • 9
6
votes
3 answers

How get output of address sanitizer when emiting SIGINT to halt a loop

When I compile this simple test program I get the obvious leak report from address sanitizer, but when I compile the same program but with a infinite loop, and break it emitting SIGINT I don't get any output. Checking asm output, the malloc is not…
Bungow
  • 420
  • 5
  • 11
6
votes
1 answer

AddressSanitizer: SEGV in _dl_get_tls_static_info

I'm trying to get ASAN working with one program, but anything I did led to ASAN:DEADLYSIGNAL, so I tried to narrow it down and instrument a small test program with only a few compiler options, just to see if it will work at all: $ cat > test.c…
user49586
6
votes
3 answers

How to set ASAN/UBSAN reporting output

I would like to run my unit test suite with -fsanitize=address,undefined and have all sanitizer errors be written to a report.txt file. By default all sanitizer errors get written to stdout, however the software also writes info to stdout so this…
Jeroen Ooms
  • 31,998
  • 35
  • 134
  • 207
6
votes
2 answers

errors with g++ 5 and 6 when using address sanitizer and additional asan flags for static initialization order

My library doctest is tested with 200+ builds on travis CI - x86/x64 Debug/Release linux/osx and with a wide range of compilers - from gcc 4.4 to 6 and clang 3.4 to 3.8 All my tests are ran through valgrind and the address sanitizer (also UB…
onqtam
  • 4,356
  • 2
  • 28
  • 50
6
votes
1 answer

LeakSanitizer: get run time leak reports?

I have inherited some legacy code and it seems to have a memory leak somewhere. My first instinct was to just compile with -faddress=sanitize -fno-omit-frame-pointer and let the Address Sanitizer's family of tools find the leak for me. I was…
rmccabe3701
  • 1,418
  • 13
  • 31
6
votes
0 answers

Link error with Xcode 7 beta, address sanitization and CocoaPods + adMob

I successfully converted an iOS project to Xcode 7 beta + Swift 2 (it runs and the tests work). However, when I turn on the new Address Sanitizer (option+run -> run -> Diagnostics -> Enable Address Sanitizer, I get the following message from the…
Gerd Castan
  • 6,275
  • 3
  • 44
  • 89
5
votes
1 answer

Address Sanitizer in MSVC: why does it report an error on startup?

I'm trying a project that uses Qt with MSVC 2019 with Address Sanitizer. I built with Address Sanitizer the project, but didn't rebuild all libs, including Qt. it crashes inside Qt in resource initialization (with qRegisterResourceData in the call…
Alex Guteniev
  • 12,039
  • 2
  • 34
  • 79
5
votes
2 answers

LINK : fatal error LNK1104: cannot open file 'clang_rt.asan_dynamic_runtime_thunk-x86_64.lib'

I'm trying to compile with the C++ address sanitizer (project property pages / C/C++ / Enable Address Sanitizer = YES), but I'm receiving the following error on compiling: LINK : fatal error LNK1104: cannot open file…
bobobobo
  • 64,917
  • 62
  • 258
  • 363
5
votes
1 answer

Integrate custom assert() with AddressSanitizer

I have a custom assert()-like macro that calls abort() on failure. When using AddressSanitizer, I would prefer to have the usual nice stack trace printed on assertion failures. How can this be achieved? Is it possible to get AddressSanitizer to…
Szabolcs
  • 24,728
  • 9
  • 85
  • 174
5
votes
1 answer

How do I exclude allocations in a tight loop from ASAN?

In a previous question, it was discovered that using recent versions of GNU libstdc++ to read a series of numbers from a space-separated human-readable file (mirror) causes a ton of allocations, scaling linearly with the size of the file. Given the…
Dan
  • 4,312
  • 16
  • 28
5
votes
2 answers

Sanitizing memory management in Go + SWIG + C++ code

I'm using a C++ library from Go via SWIG. SWIG does not take care of memory management, so the Go side looks something like this: f := NewFoo() defer DeleteFoo(f) It's easy enough to call DeleteFoo(f) when I created f, but it's easy to omit it for…
Daniel Darabos
  • 26,991
  • 10
  • 102
  • 114
5
votes
1 answer

What should I fix when Address Sanitizer says detect_leaks is not supported on this platform?

I'm using Clang to compile my project, on x86_64 OS X(MacOS 10.15.5 Catalina). I want to identify exactly from which file, which function, which line causes memory leaks. I am trying to use Address Sanitizer, specifically Leak Sanitizer. Here are…
user10719814
5
votes
1 answer

R-devel with sanitizer from rocker

I'm trying to install R devel with ASAN USBAN from rocker. Following the README I tried: sudo docker run --rm -ti rocker/r-devel-san This took a long time to download but at the end it was ok. Then I installed the sanitizers package to test R…
JRR
  • 3,024
  • 2
  • 13
  • 37