blob: 55de174322baa4468f7bbf3a3a4b684fa5ffa9a9 (
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: %clang_scudo %s -lstdc++ -o %t
// RUN: %run %t 2>&1
// Tests that the sanitizer interface functions behave appropriately.
#include <stdlib.h>
#include <vector>
#include <sanitizer/allocator_interface.h>
int main(int argc, char **argv)
{
void *p;
std::vector<ssize_t> sizes{1, 8, 16, 32, 1024, 32768,
1 << 16, 1 << 17, 1 << 20, 1 << 24};
for (size_t size : sizes) {
p = malloc(size);
if (!p)
return 1;
if (!__sanitizer_get_ownership(p))
return 1;
if (__sanitizer_get_allocated_size(p) < size)
return 1;
free(p);
}
return 0;
}
|