xref: /llvm-project/llvm/tools/llvm-microsoft-demangle-fuzzer/llvm-microsoft-demangle-fuzzer.cpp (revision c2709fcb0a5b32e42a35661fab4d5744e11d04c0)
14d7e47a5SMatt Morehouse //===--- llvm-demangle-fuzzer.cpp - Fuzzer for the Itanium Demangler ------===//
24d7e47a5SMatt Morehouse //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
64d7e47a5SMatt Morehouse //
74d7e47a5SMatt Morehouse //===----------------------------------------------------------------------===//
84d7e47a5SMatt Morehouse 
94d7e47a5SMatt Morehouse #include "llvm/Demangle/Demangle.h"
104d7e47a5SMatt Morehouse 
114d7e47a5SMatt Morehouse #include <cstdint>
124d7e47a5SMatt Morehouse #include <cstdlib>
134d7e47a5SMatt Morehouse #include <string>
144d7e47a5SMatt Morehouse 
LLVMFuzzerTestOneInput(const uint8_t * Data,size_t Size)154d7e47a5SMatt Morehouse extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
164d7e47a5SMatt Morehouse   std::string NullTerminatedString((const char *)Data, Size);
17*c2709fcbSNick Desaulniers   free(llvm::microsoftDemangle(NullTerminatedString.c_str(), nullptr, nullptr));
184d7e47a5SMatt Morehouse   return 0;
194d7e47a5SMatt Morehouse }
20