]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/test/thirdparty/Fuzzer/test/SimpleCmpTest.cpp
1 // This file is distributed under the University of Illinois Open Source
2 // License. See LICENSE.TXT for details.
4 // Simple test for a fuzzer. The fuzzer must find several narrow ranges.
10 extern int AllLines
[];
12 bool PrintOnce(int Line
) {
14 fprintf(stderr
, "Seen line %d\n", Line
);
19 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data
, size_t Size
) {
20 if (Size
!= 22) return 0;
25 memcpy(&x
, Data
, 8); // 8
26 memcpy(&y
, Data
+ 8, 8); // 16
27 memcpy(&z
, Data
+ 16, sizeof(z
)); // 20
28 memcpy(&a
, Data
+ 20, sizeof(a
)); // 22
30 if (x
> 1234567890 && PrintOnce(__LINE__
) &&
31 x
< 1234567895 && PrintOnce(__LINE__
) &&
32 a
== 0x4242 && PrintOnce(__LINE__
) &&
33 y
>= 987654321 && PrintOnce(__LINE__
) &&
34 y
<= 987654325 && PrintOnce(__LINE__
) &&
35 z
< -10000 && PrintOnce(__LINE__
) &&
36 z
>= -10005 && PrintOnce(__LINE__
) &&
37 z
!= -10003 && PrintOnce(__LINE__
) &&
39 fprintf(stderr
, "BINGO; Found the target: size %zd (%zd, %zd, %d, %d), exiting.\n",
46 int AllLines
[__LINE__
+ 1]; // Must be the last line.