#include "FuzzerPlatform.h"
#if LIBFUZZER_LINUX
#define GET_CALLER_PC() …
#define PTR_TO_REAL(x) …
#define REAL(x) …
#define FUNC_TYPE(x) …
#define DEFINE_REAL(ret_type, func, ...) …
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <dlfcn.h>
static void *getFuncAddr(const char *name, uintptr_t wrapper_addr) { … }
static int FuzzerInited = …;
static bool FuzzerInitIsRunning;
static void fuzzerInit();
static void ensureFuzzerInited() { … }
static int internal_strcmp_strncmp(const char *s1, const char *s2, bool strncmp,
size_t n) { … }
static int internal_strncmp(const char *s1, const char *s2, size_t n) { … }
static int internal_strcmp(const char *s1, const char *s2) { … }
static int internal_memcmp(const void *s1, const void *s2, size_t n) { … }
static size_t internal_strlen(const char *s) { … }
static char *internal_strstr(const char *haystack, const char *needle) { … }
extern "C" {
void __sanitizer_weak_hook_memcmp(void *called_pc, const void *s1,
const void *s2, size_t n, int result);
void __sanitizer_weak_hook_strncmp(void *called_pc, const char *s1,
const char *s2, size_t n, int result);
void __sanitizer_weak_hook_strncasecmp(void *called_pc, const char *s1,
const char *s2, size_t n, int result);
void __sanitizer_weak_hook_strcmp(void *called_pc, const char *s1,
const char *s2, int result);
void __sanitizer_weak_hook_strcasecmp(void *called_pc, const char *s1,
const char *s2, int result);
void __sanitizer_weak_hook_strstr(void *called_pc, const char *s1,
const char *s2, char *result);
void __sanitizer_weak_hook_strcasestr(void *called_pc, const char *s1,
const char *s2, char *result);
void __sanitizer_weak_hook_memmem(void *called_pc, const void *s1, size_t len1,
const void *s2, size_t len2, void *result);
DEFINE_REAL(…)
DEFINE_REAL(…)
DEFINE_REAL(…)
DEFINE_REAL(…)
DEFINE_REAL(…)
DEFINE_REAL(…)
DEFINE_REAL(…)
DEFINE_REAL(…)
DEFINE_REAL(…)
ATTRIBUTE_INTERFACE int bcmp(const char *s1, const char *s2, size_t n) { … }
ATTRIBUTE_INTERFACE int memcmp(const void *s1, const void *s2, size_t n) { … }
ATTRIBUTE_INTERFACE int strncmp(const char *s1, const char *s2, size_t n) { … }
ATTRIBUTE_INTERFACE int strcmp(const char *s1, const char *s2) { … }
ATTRIBUTE_INTERFACE int strncasecmp(const char *s1, const char *s2, size_t n) { … }
ATTRIBUTE_INTERFACE int strcasecmp(const char *s1, const char *s2) { … }
ATTRIBUTE_INTERFACE char *strstr(const char *s1, const char *s2) { … }
ATTRIBUTE_INTERFACE char *strcasestr(const char *s1, const char *s2) { … }
ATTRIBUTE_INTERFACE
void *memmem(const void *s1, size_t len1, const void *s2, size_t len2) { … }
__attribute__((section(".preinit_array"),
used)) static void (*__local_fuzzer_preinit)(void) = …;
}
static void fuzzerInit() { … }
#endif