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
4
5// abs(x) < 0 and y == Const puzzle, 64-bit variant.
6#include <cstddef>
7#include <cstdint>
8#include <cstdio>
9#include <cstdlib>
10#include <cstring>
11
12extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
13 if (Size < 16) return 0;
14 int64_t x;
15 uint64_t y;
16 memcpy(dest: &x, src: Data, n: sizeof(x));
17 memcpy(dest: &y, src: Data + sizeof(x), n: sizeof(y));
18 volatile int64_t abs_x = llabs(x: x);
19 if (abs_x < 0 && y == 0xbaddcafedeadbeefULL) {
20 printf(format: "BINGO; Found the target, exiting; x = 0x%lx y 0x%lx\n", x, y);
21 fflush(stdout);
22 exit(status: 1);
23 }
24 return 0;
25}
26
27

source code of compiler-rt/test/fuzzer/AbsNegAndConstant64Test.cpp