blob: 8ffcc0894808b1838b1d1a06e6b4eb0955feb238 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
// Interceptor can cause use-after-free
// (https://github.com/google/sanitizers/issues/321)
// XFAIL: *
// Test the backtrace() interceptor.
#include <assert.h>
#include <execinfo.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define MAX_BT 100
int main() {
void **buffer = (void **)malloc(sizeof(void *) * MAX_BT);
assert(buffer != NULL);
free(buffer);
int numEntries = backtrace(buffer, MAX_BT);
printf("backtrace returned %d entries\n", numEntries);
// CHECK: use-after-free
// CHECK: SUMMARY
return 0;
}
|