Questions tagged [ubsan]

Undefined Behavior sanitizer (ubsan) is a fast undefined behavior detector for Clang and GCC. Various computations will be instrumented to detect undefined behavior at runtime.

Undefined Behavior sanitizer (ubsan) is a fast undefined behavior detector for C and C++ programs and enabled at compile time (but the checks are performed at runtime). It is available since Clang 3.2 and GCC 4.9.

See also:

54 questions
0
votes
1 answer

Does anyone use sanitizer in released software?

Sanitizers, like: address sanitizer (ASAN); undefined behavior sanitizer (UBSAN) etc. are frequently used during development and testing. Are these tools used in released software?
lol lol
  • 141
  • 11
0
votes
0 answers

How to get rid of automatically added library provided by GCC?

I'm compiling main.c file by gcc with enabled sanitizer option. As a result, linker command contains "-lubsan" option in its arguments list. Need to say, that I haven't provided "-lubsan" option to gcc explicitly. Moreover, I'm against of using…
lol lol
  • 141
  • 11
0
votes
2 answers

Misaligned pointer use with std::shared_ptr dereference

I am working in a legacy codebase with a large amount of Objective-C++ written using manual retain/release. Memory is managed using lots of C++ std::shared_ptr, with a suitable deleter passed in on construction that calls…
0
votes
1 answer

Use UBSAN with dynamically loaded shared libraries

I tried to use UBSAN in a project and run into an issue which seems impossible to fix: The project uses a plugin system implemented via shared libraries. That is each plugin provides a factory method which returns an instance of some abstract class…
Flamefire
  • 3,954
  • 2
  • 22
  • 50
0
votes
0 answers

gcc/clang UBSan runtime error -- false positive?

I have a little project (~2k lines of code), which compiles with both clang and gcc. gcc gives the following error (-O0 optimization level): /home/nikita/projects/curse_dim/bellman/include/bellman/bellman_operators/qfunc.hpp:10:7: runtime error:…
Nikita Petrenko
  • 838
  • 1
  • 6
  • 10
0
votes
1 answer

UBSan: Store to misaligned address; what is the problem, and should I care

I've been running some code under UBSan, and found an error which I've never seen before: /usr/include/c++/7/bits/stl_algobase.h:324:8: runtime error: store to misaligned address 0x611000001383 for type 'struct complex', which requires 4 byte…
user14717
  • 3,854
  • 2
  • 26
  • 61
0
votes
1 answer

undefined reference to `__ubsan_handle_nonnull_arg'

I have been working on the problem set speller for the last days and so far this is what I have. Unfortunately, it does not compile and I am a bit lost. I would be really grateful if somebody can help me out and tell me, what I am doing wrong. //…
viet
  • 11
  • 1
0
votes
1 answer

Android nkd r15c and UBSAN clang

I am trying to build a simple Android binary to test out UBSAN (Undefined behavior sanitizer) using ndk r15c and clang. However the build fails when trying to link with the following error: jni/main.cpp:17: error: undefined reference to…
user821602
  • 31
  • 1
  • 4
-4
votes
1 answer

how to correctly cast uint32_t to unsigned

I'm trying to fix some C++ code with address sanitizer. The code says: unsigned result = *(uint32_t*)data; And the sanitizer gives: runtime error: load of misaligned address 0x6280033f410a for type 'uint32_t', which requires 4 byte alignment How…
user1600826
1 2 3
4