summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAmmar Askar <ammar@ammaraskar.com>2019-06-08 14:43:16 (GMT)
committerGregory P. Smith <greg@krypto.org>2019-06-08 14:43:16 (GMT)
commita15a7bcaea54e1845ab2abe27e6f583294cd715b (patch)
treed1dde02d76ba37a7445491ac90de2b643599eea3 /Modules
parentd407d2a7265f6102e51a1d62b3fd28b4f7a78d16 (diff)
downloadcpython-a15a7bcaea54e1845ab2abe27e6f583294cd715b.zip
cpython-a15a7bcaea54e1845ab2abe27e6f583294cd715b.tar.gz
cpython-a15a7bcaea54e1845ab2abe27e6f583294cd715b.tar.bz2
bpo-29505: Fix interpreter in fuzzing targets to be relocatable (GH-13907)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_xxtestfuzz/fuzzer.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/_xxtestfuzz/fuzzer.c b/Modules/_xxtestfuzz/fuzzer.c
index b50eb65..54f816e 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.