//===-- strcmp_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 strcmp implementation. /// //===----------------------------------------------------------------------===// #include "src/string/strcmp.h" #include <stddef.h> #include <stdint.h> // The general structure is to take the value of the first byte, set size1 to // that value, and add the null terminator. size2 will then contain the rest of // the bytes in data. // For example, with inputs (data={2, 6, 4, 8, 0}, size=5): // size1: data[0] = 2 // data1: {2, 6} + '\0' = {2, 6, '\0'} // size2: size - size1 = 3 // data2: {4, 8, '\0'} extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { … }