Status: Accepted
Owner:
euge...@google.com
Labels: Type-Defect Priority-Medium
New issue 82 by
euge...@google.com: Origin lost in unaligned memcpy
https://code.google.com/p/memory-sanitizer/issues/detail?id=82
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.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings