bpo-29505: Fix interpreter in fuzzing targets to be relocatable (GH-1… · python/cpython@6692d35

Original file line numberDiff line numberDiff line change

@@ -88,6 +88,14 @@ static int _run_fuzz(const uint8_t *data, size_t size, int(*fuzzer)(const char*

8888

/* CPython generates a lot of leak warnings for whatever reason. */

8989

int __lsan_is_turned_off(void) { return 1; }

9090
91+

wchar_t wide_program_name[NAME_MAX];

92+
93+

int LLVMFuzzerInitialize(int *argc, char ***argv) {

94+

wchar_t* wide_program_name = Py_DecodeLocale(*argv[0], NULL);

95+

Py_SetProgramName(wide_program_name);

96+

return 0;

97+

}

98+
9199

/* Fuzz test interface.

92100

This returns the bitwise or of all fuzz test's return values.

93101