diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-06-08 08:03:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-08 08:03:46 -0700 |
commit | 6692d35317a45905a043dccae3940ea5d5d84352 (patch) | |
tree | 8dba93ed2df48ec61b1e2aaa6f7bf74b43e326dd /Modules/_xxtestfuzz | |
parent | e36ed475ea429f7cc80a4d65f80b44686a74b246 (diff) | |
download | cpython-git-6692d35317a45905a043dccae3940ea5d5d84352.tar.gz |
bpo-29505: Fix interpreter in fuzzing targets to be relocatable (GH-13907)
(cherry picked from commit a15a7bcaea54e1845ab2abe27e6f583294cd715b)
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
Diffstat (limited to 'Modules/_xxtestfuzz')
-rw-r--r-- | Modules/_xxtestfuzz/fuzzer.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/_xxtestfuzz/fuzzer.c b/Modules/_xxtestfuzz/fuzzer.c index b50eb65127..54f816ebc9 100644 --- a/Modules/_xxtestfuzz/fuzzer.c +++ b/Modules/_xxtestfuzz/fuzzer.c @@ -88,6 +88,14 @@ static int _run_fuzz(const uint8_t *data, size_t size, int(*fuzzer)(const char* /* CPython generates a lot of leak warnings for whatever reason. */ int __lsan_is_turned_off(void) { return 1; } +wchar_t wide_program_name[NAME_MAX]; + +int LLVMFuzzerInitialize(int *argc, char ***argv) { + wchar_t* wide_program_name = Py_DecodeLocale(*argv[0], NULL); + Py_SetProgramName(wide_program_name); + return 0; +} + /* Fuzz test interface. This returns the bitwise or of all fuzz test's return values. |