Questions tagged [sanitizer]

Sanitizers are a compiler feature supported by Clang and GCC for instrumenting programs to do dynamic analysis and catch many classes of bugs at runtime.

Sanitizers are a compiler feature supported by Clang and GCC for instrumenting programs to do dynamic analysis. There are sanitizers to detect many issues, including many C and C++ "undefined behaviors", signed integer arithmetic overflow, memory allocation errors, use of uninitialized memory, and data races between threads.

These checks can be enabled at compile time using the -fsanitize= option (for example, -fsanitize=address).

The following sanitizers are supported:

More information on the sanitizers development can be found at http://compiler-rt.llvm.org/.

The current list of supported options can be found in the compiler documentation:

120 questions
1
vote
1 answer

How to make MemorySanitizer not stop after one error

Clang's documentation says that "By default, MemorySanitizer exits on the first detected error." Does somebody know how to make MemorySanitizer not to stop on errors? The above sentence suggests that there is a way, but I do not find anything in the…
robert
  • 3,539
  • 3
  • 35
  • 56
1
vote
1 answer

False negative with address sanitizer?

Consider the code below. No error is shown when I compile and run it with address sanitizer. But there should be an error right i.e assigning/accessing out of bounds memory location? Why doesn't address sanitizer detect it? int arr[30]; int…
1
vote
1 answer

How to check if malloc() overcommits memory

In my C program, based on the user's input, memory will be allocated for a given simulation. The initial problem I faced is that user can ask for a huge number to allocate but malloc() never fails until it runs out of memory then the program…
Pourya
  • 21
  • 4
1
vote
3 answers

What tools can report such uses of uninitialized variables?

Consider the following program struct X { int d; X(){} // forget to initialize d }; int main() { X x; volatile int y=x.d; // read uninitialized d (void)y; // (kill useless warning) } Clearly it has undefined behavior, which I'd…
Ruslan
  • 18,162
  • 8
  • 67
  • 136
1
vote
1 answer

Java sanitizing Arraylist records suggestions

I am looking for an idea how to accomplish this task. So I'll start with how my program is working. My program reads a CSV file. They are key value pairs separated by a comma. L1234456,ygja-3bcb-iiiv-pppp-a8yr-c3d2-ct7v-giap-24yj-3gie …
user1158745
  • 2,402
  • 9
  • 41
  • 60
0
votes
0 answers

Do I need to sanitise TIPTAP text editor in nextJS?

do I need to sanitise TIPTAP text editor with nextJs? If so, what sanitiser is best with nextJS and TIPTAP text editor?
Tony
  • 5
  • 3
0
votes
1 answer

Iterator invalidation for associative containers

I know that erasing elements from an associative container inside a for loop invalidates it. Is it the case when using a range based loop? #include #include #include #include #include struct A…
Peter
  • 109
  • 7
0
votes
0 answers

"relocation truncated to fit: R_X86_64_PC32" issue while using HWAddressSanitizer

I try to use the HWAddressSanitizer option in clang on an Ubuntu 20.04.3 LTS, but it results in a relocation truncated to fit: R_X86_64_PC32 against '.data' error while compiling. The compiler comes from the clang-12 package installed by…
AceSrc
  • 11
  • 1
0
votes
0 answers

Leakage message from sanitizer for program that does not allocate anything

I have some code that does almost nothing, but it does so in a convoluted way. Most importantly, it does not allocate anything. All data is on the stack. It works just fine with many versions of gcc and clang, both on my computer as well as with…
Patrick Fromberg
  • 1,313
  • 11
  • 37
0
votes
0 answers

downloadable font: rejected by sanitizer (font-family: "summernote" style:normal weight:400 stretch:100 src index:2)

I'm facing some problems with this summernote font-family, it's being rejected by the sanitizer, and the error are pointing to this css…
0
votes
0 answers

global varible address truncated when compile with clang memory sanitizer

I'm trying to build my code with clang memory sanitizer. I get following error when execuatable starts: thread #1, name = 'esp_exec-N', stop reason = signal SIGSEGV: invalid address (fault address: 0x555643df5c8) frame #0: 0x000055555b7806ae…
Ying Liu
  • 31
  • 5
0
votes
1 answer

Issue with UBA sanitizer casting negative double to unsigned long long on C++

I've been working with C++ and have been utilizing the UBA sanitizer to convert a double to an unsigned long long. However, I've been encountering an issue when the value is negative, which results in the error message: "runtime error: value -2 is…
Raz Cohen
  • 79
  • 1
  • 7
0
votes
0 answers

Compile a C code with Sanitizer, use python subprocess to run the program but returncode always 0

I use Sanitizer to compile C code, my compile cmd is: gcc -fsanitize=address -fsanitize=leak -o test test.c. When I run ./test in shell, I got the LeakSanitizer Error info. But When I use subprocess to run ./test in python, I got no stderr and the…
icy17
  • 9
0
votes
1 answer

How do I use the new Sanitizer API from Typescript?

This works all fine on Codepen, even without window. I am surprised about that because I am used to be forced to use ẁindow.x if ( 'Sanitizer' in window ) { console.log( 'sani', 'Sanitizer' in window ); } const c = new Sanitizer(); console.log(…
redanimalwar
  • 1,229
  • 1
  • 12
  • 32
0
votes
1 answer

Can't fix heap-buffer-overflow error on my C code

I need help fixing an fsanitize=address error on this code. If I compile my .c program with the flags "fsanitize=address -g" I get the following error: ==93042==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000107903a7c at pc…