diff options
Diffstat (limited to 'projects/libchewing/chewing_fuzzer_common.c')
-rw-r--r-- | projects/libchewing/chewing_fuzzer_common.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/projects/libchewing/chewing_fuzzer_common.c b/projects/libchewing/chewing_fuzzer_common.c deleted file mode 100644 index 34426ea37..000000000 --- a/projects/libchewing/chewing_fuzzer_common.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "chewing_fuzzer_common.h" - -#include <libgen.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -static char userphrase_path[] = "/tmp/chewing_userphrase.db.XXXXXX"; - -int LLVMFuzzerInitialize(int* argc, char*** argv) { - char* exe_path = (*argv)[0]; - - // dirname() can modify its argument. - char* exe_path_copy = strdup(exe_path); - char* dir = dirname(exe_path_copy); - - // Assume data files are at the same location as executable. - setenv("CHEWING_PATH", dir, 0); - free(exe_path_copy); - - // Specify user db of this process. So we can run multiple fuzzers at the - // same time. - mktemp(userphrase_path); - setenv("TEST_USERPHRASE_PATH", userphrase_path, 0); - return 0; -} - -int get_fuzz_input() { - if (fuzz_ptr - fuzz_input >= fuzz_size) - return EOF; - return *fuzz_ptr++; -} |