blob: 1aa71ffc159aae82ed9f093dfee98af79cbdfd3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// Check that memset() call from a shared library gets intercepted.
// RUN: %clangxx_asan -O0 %p/SharedLibs/shared-lib-test-so.cc \
// RUN: -shared -o %T/libinterception-in-shared-lib-test.so \
// RUN: -fPIC
// RUN: %clangxx_asan -O0 %s -o %t -Wl,-R,\$ORIGIN -L%T -linterception-in-shared-lib-test && \
// RUN: not %t 2>&1 | FileCheck %s
#include <stdio.h>
#include <string.h>
extern "C" void my_memset(void *p, size_t sz);
int main(int argc, char *argv[]) {
char buf[10];
my_memset(buf, 11);
// CHECK: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}}
// CHECK: {{WRITE of size 11 at 0x.* thread T0}}
// CHECK: {{ #0 0x.* in my_memset .*shared-lib-test-so.cc:31}}
return 0;
}
|