diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-10-28 18:53:37 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-10-28 18:53:37 +0000 |
commit | 1767ec1c0d56bf9a4a5470ec5b28905e23892753 (patch) | |
tree | 9bddda2a30f050558fdeb65ae5735d2dfb5bbd16 /lib | |
parent | f456018a324dc48668a57060f5ac9c838dfd9f32 (diff) | |
download | compiler-rt-1767ec1c0d56bf9a4a5470ec5b28905e23892753.tar.gz |
[msan] Fix a typo and enable poison_in_free flag.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/msan/lit_tests/poison_in_free.cc | 16 | ||||
-rw-r--r-- | lib/msan/msan.cc | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/msan/lit_tests/poison_in_free.cc b/lib/msan/lit_tests/poison_in_free.cc new file mode 100644 index 000000000..f134d05ab --- /dev/null +++ b/lib/msan/lit_tests/poison_in_free.cc @@ -0,0 +1,16 @@ +// RUN: %clangxx_msan -O0 %s -o %t && not %t >%t.out 2>&1 +// FileCheck %s <%t.out +// RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=poison_in_free=0 %t >%t.out 2>&1 + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int main(int argc, char **argv) { + char *volatile x = (char*)malloc(50 * sizeof(char)); + memset(x, 0, 50); + free(x); + return x[25]; + // CHECK: MemorySanitizer: use-of-uninitialized-value + // CHECK: #0 {{.*}} in main{{.*}}poison_in_free.cc:[[@LINE-2]] +} diff --git a/lib/msan/msan.cc b/lib/msan/msan.cc index 7865044c4..923843154 100644 --- a/lib/msan/msan.cc +++ b/lib/msan/msan.cc @@ -122,7 +122,7 @@ static void ParseFlagsFromString(Flags *f, const char *str) { ParseFlag(str, &f->poison_heap_with_zeroes, "poison_heap_with_zeroes"); ParseFlag(str, &f->poison_stack_with_zeroes, "poison_stack_with_zeroes"); ParseFlag(str, &f->poison_in_malloc, "poison_in_malloc"); - ParseFlag(str, &f->poison_in_malloc, "poison_in_free"); + ParseFlag(str, &f->poison_in_free, "poison_in_free"); ParseFlag(str, &f->exit_code, "exit_code"); if (f->exit_code < 0 || f->exit_code > 127) { Printf("Exit code not in [0, 128) range: %d\n", f->exit_code); |