1 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2 // See https://llvm.org/LICENSE.txt for license information.
3 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 // The fuzzer must find several constants with swapped bytes.
11 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data
, size_t Size
) {
12 if (Size
< 14) return 0;
16 memcpy(&x
, Data
, sizeof(x
));
17 memcpy(&y
, Data
+ Size
/ 2, sizeof(y
));
18 memcpy(&z
, Data
+ Size
- sizeof(z
), sizeof(z
));
20 x
= __builtin_bswap64(x
);
21 y
= __builtin_bswap32(y
);
22 z
= __builtin_bswap32(z
);
23 const bool k32bit
= sizeof(void*) == 4;
25 if ((k32bit
|| x
== 0x46555A5A5A5A5546ULL
) &&
30 if (Data
[Size
- 5] == 'z') {
31 fprintf(stderr
, "BINGO; Found the target\n");