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 Morehouseextern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 164d7e47a5SMatt Morehouse std::string NullTerminatedString((const char *)Data, Size); 17*3b01fa26SNick Desaulniers if (char *demangle = llvm::itaniumDemangle(NullTerminatedString.c_str())) 184d7e47a5SMatt Morehouse free(demangle); 194d7e47a5SMatt Morehouse 204d7e47a5SMatt Morehouse return 0; 214d7e47a5SMatt Morehouse } 22