forked from OSchip/llvm-project
[msan] Fix a typo and enable poison_in_free flag.
llvm-svn: 193529
This commit is contained in:
parent
cdd2c0044d
commit
d828208713
|
@ -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]]
|
||||
}
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue