aboutsummaryrefslogtreecommitdiff
path: root/lib/asan/output_tests/interception_test-linux.cc
blob: 0523510465a1ff71fb48530192b57e264460f324 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdlib.h>
#include <stdio.h>

extern "C" long __interceptor_strtol(const char *nptr, char **endptr, int base);
extern "C" long strtol(const char *nptr, char **endptr, int base) {
  fprintf(stderr, "my_strtol_interceptor\n");
  return __interceptor_strtol(nptr, endptr, base);
}

int main() {
  char *x = (char*)malloc(10 * sizeof(char));
  free(x);
  return (int)strtol(x, 0, 10);
}

// Check-Common: my_strtol_interceptor
// Check-Common: heap-use-after-free