[asan] Fix a flaky test.
This test has a chance to hit some other random allocation and get neither heap overflow nor SEGV. Relax test condition to only check that there is no internal CHECK failure. llvm-svn: 217769
This commit is contained in:
parent
6e195426e7
commit
a59459de27
|
@ -8,16 +8,16 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
fprintf(stderr, "main\n");
|
||||
int *x = new int[5];
|
||||
memset(x, 0, sizeof(x[0]) * 5);
|
||||
int index = atoi(argv[1]);
|
||||
int res = x[index];
|
||||
// CHECK: AddressSanitizer: {{(heap-buffer-overflow|SEGV)}}
|
||||
// CHECK: #0 0x{{.*}} in main {{.*}}heap-overflow-large.cc:[[@LINE-2]]
|
||||
// CHECK: AddressSanitizer can not {{(provide additional info|describe address in more detail \(wild memory access suspected\))}}
|
||||
// CHECK: SUMMARY: AddressSanitizer: {{(heap-buffer-overflow|SEGV)}}
|
||||
// CHECK: main
|
||||
// CHECK-NOT: CHECK failed
|
||||
delete[] x;
|
||||
return res;
|
||||
return res ? res : 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue