1#include <cstdint>
2#include <cstdio>
3
4struct Simple {
5 int x_;
6 Simple() {
7 x_ = 5;
8 }
9 ~Simple() {
10 x_ += 1;
11 }
12};
13
14Simple *volatile SimpleSink;
15
16extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
17 if (Size < 4) return 0;
18 if (Data[0] == 'F' && Data[1] == 'U' && Data[2] == 'Z' && Data[3] == 'Z') {
19 {
20 Simple S;
21 SimpleSink = &S;
22 }
23 if (SimpleSink->x_) fprintf(stderr, "Failed to catch use-after-dtor\n");
24 }
25 return 0;
26}
27
28