llvm-project/libcxxabi/fuzz/cxa_demangle_fuzzer.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
395 B
C++
Raw Normal View History

#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
extern "C" char *
__cxa_demangle(const char *mangled_name, char *buf, size_t *n, int *status);
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
char *str = new char[size+1];
memcpy(str, data, size);
str[size] = 0;
free(__cxa_demangle(str, 0, 0, 0));
delete [] str;
return 0;
}