fuzz: Pass SystemRoot environment variable to subprocess

See https://docs.python.org/3/library/subprocess.html
This commit is contained in:
Hennadii Stepanov 2024-04-18 10:27:46 +01:00
parent 23cb8207cd
commit 52933d7283
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

View File

@ -11,6 +11,7 @@ import argparse
import configparser
import logging
import os
import platform
import random
import subprocess
import sys
@ -18,7 +19,7 @@ import sys
def get_fuzz_env(*, target, source_dir):
symbolizer = os.environ.get('LLVM_SYMBOLIZER_PATH', "/usr/bin/llvm-symbolizer")
return {
fuzz_env = {
'FUZZ': target,
'UBSAN_OPTIONS':
f'suppressions={source_dir}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1',
@ -27,6 +28,10 @@ def get_fuzz_env(*, target, source_dir):
'ASAN_SYMBOLIZER_PATH':symbolizer,
'MSAN_SYMBOLIZER_PATH':symbolizer,
}
if platform.system() == "Windows":
# On Windows, `env` option must include valid `SystemRoot`.
fuzz_env = {**fuzz_env, 'SystemRoot': os.environ.get('SystemRoot')}
return fuzz_env
def main():