Clang r227077.
#include <sanitizer/msan_interface.h>
#include <string.h>
int main() {
char x[8];
char y[8];
memset(x, 0, 8);
__msan_allocated_memory(&x[6], 1);
memset(y, 0, 8);
memcpy(y + 1, x, 7);
__msan_print_shadow(y + 1, 7);
return 0;
}
Compile with -fsanitize=memory -fsanitize-memory-track-origins=2.
Output:
Shadow map of [0x3fffb04da71d, 0x3fffb04da724), 7 bytes:
0x3fffb04da71c: ..000000 000000ff ........ ........ |. A . .|
Origin A (origin_id 80000002):
Uninitialized value was created by an allocation of 'y' in the stack frame of function 'main'
#0 0x7f2811843410 in main (/code/llvm/build/a.out+0x70410)
memcpy() did not update origin for y.
Original issue reported on code.google.com by euge...@google.com on 26 Jan 2015 at 9:56
Original issue reported on code.google.com by
euge...@google.com
on 26 Jan 2015 at 9:56