blob: 4c1a4130e0b61b7eff2d4133cdd7ef361b85ec1a [file] [log] [blame]
Matt Morehouseb1b02b72017-10-13 17:35:37 +00001//===--- llvm-demangle-fuzzer.cpp - Fuzzer for the Itanium Demangler ------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "llvm/Demangle/Demangle.h"
11
12#include <cstdint>
13#include <cstdlib>
14#include <string>
15
16extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
Nico Weber576e6bc2018-12-19 20:19:58 +000017 std::string NullTerminatedString((const char *)Data, Size);
Matt Morehouseb37be362019-01-07 16:14:00 +000018 free(llvm::microsoftDemangle(NullTerminatedString.c_str(), nullptr, nullptr,
19 nullptr));
Matt Morehouseb1b02b72017-10-13 17:35:37 +000020 return 0;
21}