1 // Simple test for a fuzzer. The fuzzer must find several narrow ranges.
2 #include <cstdint>
3 #include <cstdlib>
4 #include <cstring>
5 #include <cstdio>
6
TestOneInput(const uint8_t * Data,size_t Size)7 extern "C" void TestOneInput(const uint8_t *Data, size_t Size) {
8 if (Size < 14) return;
9 uint64_t x = 0;
10 int64_t y = 0;
11 int z = 0;
12 unsigned short a = 0;
13 memcpy(&x, Data, 8);
14 memcpy(&y, Data + Size - 8, 8);
15 memcpy(&z, Data + Size / 2, sizeof(z));
16 memcpy(&a, Data + Size / 2 + 4, sizeof(a));
17
18 if (x > 1234567890 &&
19 x < 1234567895 &&
20 y >= 987654321 &&
21 y <= 987654325 &&
22 z < -10000 &&
23 z >= -10005 &&
24 z != -10003 &&
25 a == 4242) {
26 fprintf(stderr, "Found the target: size %zd (%zd, %zd, %d, %d), exiting.\n",
27 Size, x, y, z, a);
28 exit(1);
29 }
30 }
31