27 lines · cpp
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-exception4 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(&x, Data, sizeof(x));17 memcpy(&y, Data + sizeof(x), sizeof(y));18 volatile int64_t abs_x = llabs(x);19 if (abs_x < 0 && y == 0xbaddcafedeadbeefULL) {20 printf("BINGO; Found the target, exiting; x = 0x%lx y 0x%lx\n", x, y);21 fflush(stdout);22 exit(1);23 }24 return 0;25}26 27