1 | // RUN: %clangxx_asan -fsanitize-address-use-after-return=never -O %s -o %t && %run %t |
2 | |
3 | #include <assert.h> |
4 | #include <setjmp.h> |
5 | #include <stdio.h> |
6 | #include <sanitizer/asan_interface.h> |
7 | |
8 | static jmp_buf buf; |
9 | |
10 | int main() { |
11 | char x[32]; |
12 | fprintf(stderr, format: "\nTestLongJmp\n" ); |
13 | fprintf(stderr, format: "Before: %p poisoned: %d\n" , &x, |
14 | __asan_address_is_poisoned(addr: x + 32)); |
15 | assert(__asan_address_is_poisoned(x + 32)); |
16 | if (0 == setjmp(buf)) |
17 | longjmp(env: buf, val: 1); |
18 | fprintf(stderr, format: "After: %p poisoned: %d\n" , &x, |
19 | __asan_address_is_poisoned(addr: x + 32)); |
20 | assert(!__asan_address_is_poisoned(x + 32)); |
21 | } |
22 | |