Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
601 views

GNU compiler memory sanitizer is not available [duplicate]

When I try to build my c++ project with memory sanitizer using the CMake sanitizers modules here, I get this warning: MemorySanitizer is not available for GNU compiler. Although when I searched on ...
E. Tolga's user avatar
3 votes
1 answer
179 views

Does `string s = std::to_string(1) + std::to_string(2)` use uninitialized memory

The question is, does the following snippet use uninitialized memory, as reported by Google's MemorySanitizer? Or is it a false positive?: main.cpp: #include <string> #include <iostream> ...
D.J. Elkind's user avatar
1 vote
1 answer
2k views

How do I tell clang memory sanitizer to ignore data from certain libraries?

For example I'd like to ignore sqlite and zlib because I know they're well tested. I grabbed the zpipe.c example and built it like this. Keep in mind I'm using -lz and not building zlib myself. I'm ...
Eric Stotch's user avatar
1 vote
2 answers
114 views

MemorySanitzer warns of use of undefined memory in `struct stat`; I do check the `stat` return value, though

struct stat st; if (stat(python_pkgdir, &st)) { qd_error_errno(errno, "Cannot find Python library path '%s'", python_pkgdir); return NULL; } else ...
user7610's user avatar
  • 28.5k
1 vote
1 answer
2k views

Clang sanitizers missing a read from uninitialized memory

I have the following code, that I am confident reads from garbage memory, but clang sanitizers do not complain. Is there something I can do to make them trigger or I should just accept this as ...
NoSenseEtAl's user avatar
  • 29.9k
3 votes
2 answers
1k views

Why does the memory-sanitizer report use of an uninitialized value for std::map?

I'm using manjaro linux on x86-64. Memory-sanitizer in clang version 10.0.1 reported a use of uninitialized value error in std::map, which quite surprised me. Did I do something wrong? $ cat test.cpp ...
Pac's user avatar
  • 167
1 vote
0 answers
227 views

Boost undefined symbol issue while linking with static library with memory sanitizer

I am getting below error while building static library uhd-types and linking with boost libraries v1.74 with memory sanitizer flag -fsanitize=memory. [ 63%] Built target uhd-types [ 65%] Linking CXX ...
Pawan's user avatar
  • 11
3 votes
0 answers
254 views

Clang memory sanitizer bug with SSE intrinsics

Here is a piece of code that generates an internal compiler error if I compile and run it with clang having memory sanitizer enabled. It mainly just puts some data into an SSE register and calls a ...
Fabian Langguth's user avatar
0 votes
1 answer
255 views

Does enabling LLVM's MemorySanitizer change the ABI of libraries

The LLVM projects MemorySanitizer has a somewhat difficult to satisfy constraint that all system libraries must also be built with MemorySanitizer. I've been thinking about some ways to enable MSAN ...
acm's user avatar
  • 12.7k
1 vote
0 answers
612 views

cannot build memory sanitizer instrumented libc++ that link against only compile-rt (no libgcc)?

I want to use c++ memory sanitizer(msan) on a code repo with llvm toolchain (libc++, libunwind, compiler-rt, clang ...). so the first thing i need to do is to build msan-instrumented libc++. From ...
JohnNil's user avatar
  • 33
2 votes
0 answers
1k views

clang sanitize-blacklist is not ignoring a function

I am using clang 7.0.1-6 with -fsatize=memory and -fsanitize-blacklist to ignore unitialized memory in libc. Unfortunately it seems that msan does not ignore cap_init, or it's descendants. $ cat /...
cmouse's user avatar
  • 672
2 votes
1 answer
291 views

Memory sanitizer error: clang5 + msan + fwrite of structs with padding bytes

Minimum example: #include <fstream> struct TFoo { bool Field1_ = false; uint64_t Field2_ = 0; }; int main() { TFoo Foo_{}; const char* filename = "text.txt"; std::ofstream ...
vladon's user avatar
  • 8,391
2 votes
0 answers
179 views

Memory Sanitizer use-of-uninitialized-value with ifstream [duplicate]

Here's a minimal example to reproduce - #include <iostream> #include <string> #include <fstream> using namespace std; int main() { ifstream names("lol.txt"); if(!names) { ...
Abhinav Gauniyal's user avatar
1 vote
2 answers
6k views

clang++ memory sanitizer reports use-of-uninitialized-value

This code is taken from IncludeOS github page. I modified it a bit so that it compiles without other header files. find function from IncludeOS is a bit too verbose, so I want to simplify it. But ...
MaxPlankton's user avatar
  • 1,248
55 votes
2 answers
39k views

Memory/Address Sanitizer vs Valgrind

I want some tool to diagnose use-after-free bugs and uninitialized bugs. I am considering Sanitizer(Memory and/or Address) and Valgrind. But I have very little idea about their advantages and ...
kayas's user avatar
  • 723
0 votes
1 answer
1k views

Using Memory Sanitizer instrumented libc++

I have built an instrumented libc++ as described here. I have set the flags as the above site suggests: MSAN_CFLAGS="-fsanitize=memory -stdlib=libc++ -L/path_to/llvm-build-msan/lib -lc++abi -I/...
robert's user avatar
  • 3,686
3 votes
1 answer
3k views

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 ...
robert's user avatar
  • 3,686
4 votes
2 answers
3k views

How can I practically use AddressSanitizer and MemorySanitizer?

AddressSanitizer and MemorySanitizer are very useful tools, but they require that the whole program be appropriately instrumented. (At least, for the Clang version of AddressSanitizer; see here in the ...
Josh Kelley's user avatar
  • 58.2k
29 votes
3 answers
6k views

Using memory sanitizer with libstdc++

I wish to use the -fsanitize=memory flag in clang to analyse a program like the following: #include <string> #include <iostream> #include <fstream> using namespace std; void ...
soandos's user avatar
  • 5,138