//===-- uint_fuzz.cpp -----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// Fuzzing test for llvm-libc unsigned integer utilities. /// //===----------------------------------------------------------------------===// #include "src/__support/CPP/bit.h" #include "src/__support/big_int.h" #include "src/string/memory_utils/inline_memcpy.h" usingnamespaceLIBC_NAMESPACE; // Helper function when using gdb / lldb to set a breakpoint and inspect values. template <typename T> void debug_and_trap(const char *msg, T a, T b) { … } #define DEBUG_AND_TRAP() … #define TEST_BINOP(OP) … #define TEST_SHIFTOP(OP) … #define TEST_FUNCTION(FUN) … // Test that basic arithmetic operations of BigInt behave like their scalar // counterparts. template <typename T, typename BigInt> void run_tests(T a, T b) { … } // Reads a T from libfuzzer data. template <typename T> T read(const uint8_t *data, size_t &remainder) { … } template <typename T, typename BigInt> void run_tests(const uint8_t *data, size_t size) { … } extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { … }