[msan] Fix a typo and enable poison_in_free flag.

llvm-svn: 193529
This commit is contained in:
Evgeniy Stepanov 2013-10-28 18:53:37 +00:00
parent cdd2c0044d
commit d828208713
2 changed files with 17 additions and 1 deletions

View File

@ -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]]
}

View File

@ -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);