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
5
votes
1 answer

How to enable address sanitizer at godbolt.org

I am trying to enable address sanitizer at godbolt.org with -fsanitize=address, but get error: ==3==ERROR: AddressSanitizer failed to allocate 0xdfff0001000 (15392894357504) bytes at address 2008fff7000 (errno: 12) ==3==ReserveShadowMemoryRange…
Rualark
  • 445
  • 1
  • 5
  • 18
5
votes
1 answer

Understanding a stack-use-after-scope error

I am working on a multithreaded client using C and the pthreads library, using a boss/worker arch design and am having issues understanding/debugging a stack-use-after-scope error that is causing my client to fail. (I am kinda new to C) I have tried…
CjRobin
  • 161
  • 1
  • 1
  • 14
5
votes
1 answer

LeakSanitizer and leaky libraries

I am trying to use gcc's leak sanitizer option to detect leaks in my program. For this I compile with the rlevant flags, run my program, then terminate, which results in the following output: ==8013==ERROR: LeakSanitizer: detected memory…
Makogan
  • 8,208
  • 7
  • 44
  • 112
5
votes
1 answer

How to configure bazel to run address / memory sanitizer?

I have project in bazel with very simple bulid rule cc_binary( name = "search", srcs = [ "iterator_range.h", "main.cpp", "parse.cpp", "parse.h", "search_server.cpp", "search_server.h", "test_runner.h", …
yname
  • 2,189
  • 13
  • 23
5
votes
0 answers

c++ code compiled with -fsanitize=address crashes

I used gcc 6.3.0 with address sanitizer to compile the following code: #include int increment(int &x) { x++; return x; } int main() { int x = 0; increment(x); return 0; } The code gets compiled and instrumented.…
Melkjot
  • 498
  • 3
  • 13
5
votes
1 answer

How to set up llvm-symbolizer?

I was able to push the ASAN related libs located in ANDROID_SDK using the script "asan_device_setup" located inside "Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/7.0.2/bin" from my MacOS. However, I am unable to get any…
user1128265
  • 2,891
  • 10
  • 29
  • 34
5
votes
1 answer

Getting undefined symbol: __asan_memset when trying to use Clang address sanitizer

I'm trying to use address sanitizer with clang to compile a C++ application but getting the following error: /Class.so: undefined symbol: __asan_memset I have added -fsanitize=address to the compiler flags /opt/llvm-3.8.0/bin/clang++ -M…
user997112
  • 29,025
  • 43
  • 182
  • 361
5
votes
2 answers

Runtime check for LeakSanitizer (detect_leaks=1)

I have an issue where any Leak Sanitizer backtraces that go through dynamically loaded libraries report Unknown Module for any function calls within that library. Direct leak of 48 byte(s) in 1 object(s) allocated from: #0 0x4e3e36 in malloc…
Arran Cudbard-Bell
  • 5,912
  • 2
  • 26
  • 48
5
votes
2 answers

How to generate core dump when use Address Sanitizer and gcc7.1.0

I compiled my code with -fsanitize=address on centOS 7.2.1511. When I updated gcc to 7.1.0, it can't generate core dump file anymore. Can anybody help me? gcc compile options: -lm -g3 -Wall -Wno-unknown-pragmas --std=c++11 -Werror -ggdb…
WenJuan Wu
  • 99
  • 1
  • 7
5
votes
2 answers

AddressSanitizer and loading of dynamic libraries at runtime -> ()

I am using AddressSanitizer for all my projects in order to detect memory leaks, heap corruptions etc. However, when loading a dynamic library at runtime via dlopen, the output of AddressSanitizer leaves a lot to be desired. I wrote a simple test…
kamshi
  • 605
  • 6
  • 19
5
votes
1 answer

Xcode Address Sanitizer with ccache

I'm trying to use the Address Sanitizer in Xcode, but I'm also using ccache to accelerate my builds. To do this, I've set the CC flag at the Xcode-project-level to point to a script I'm storing at ~/projects/support/cmake/ccache-clang. The script…
yano
  • 4,095
  • 3
  • 35
  • 68
5
votes
1 answer

Manual poisoning of std::vector

In the following code snippet there is an error that is not trivial but I would have expected tools like AddressSanitizer to catch it. #include #include int main () { std::vector toto; toto.push_back(2); int const& titi…
moeryn
  • 198
  • 2
  • 12
5
votes
0 answers

How to detect modification of C++ object's pointer to vtable at runtime?

Let vptr be the pointer to the vtable which is carried along objects whose classes are subject to virtual functions. Alteration of the 'vptr' is likely not intended behavior. However, such alterations cannot be detected as illegal memory…
Frank-Rene Schäfer
  • 3,182
  • 27
  • 51
5
votes
1 answer

ERROR: AddressSanitizer: heap-buffer-overflow on address X at pc Y bp Z sp W

I'm pretty new to dynamic memory management and using Fsanitise flag to find problems with memory management. I cannot use vector to store data - I need to use primitive arrays, as well as "new" and "delete" to manage the heap objects. I got the…
5
votes
1 answer

asan with g++ 5.4.0 not working on travis CI

until recently my builds with g++ 5 on travis using the address sanitizer were passing - in the past week they broke. I see that the version of g++ is bumped from (Ubuntu 5.2.1-23ubuntu1~12.04) 5.2.1 20151031 to (Ubuntu 5.4.0-3ubuntu1~12.04) 5.4.0…
onqtam
  • 4,356
  • 2
  • 28
  • 50