//===-- printf_parser_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 qsort implementation. /// //===----------------------------------------------------------------------===// #include "src/__support/arg_list.h" #include "src/stdio/printf_core/parser.h" #include <stdarg.h> #include <stdint.h> usingnamespaceLIBC_NAMESPACE; // The design for the printf parser fuzzer is fairly simple. The parser uses a // mock arg list that will never fail, and is passed a randomized string. The // format sections it outputs are checked against a count of the number of '%' // signs are in the original string. This is a fairly basic test, and the main // intent is to run this under sanitizers, which will check for buffer overruns. extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { … }