diff --git a/fuzzing/fuzz-targets/fuzz_config.py b/fuzzing/fuzz-targets/fuzz_config.py index 6f2caad4b..4eddc32ff 100644 --- a/fuzzing/fuzz-targets/fuzz_config.py +++ b/fuzzing/fuzz-targets/fuzz_config.py @@ -23,15 +23,15 @@ import os from configparser import MissingSectionHeaderError, ParsingError +if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"): + path_to_bundled_git_binary = os.path.abspath(os.path.join(os.path.dirname(__file__), "git")) + os.environ["GIT_PYTHON_GIT_EXECUTABLE"] = path_to_bundled_git_binary + with atheris.instrument_imports(): import git def TestOneInput(data): - if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"): - path_to_bundled_git_binary = os.path.abspath(os.path.join(os.path.dirname(__file__), "git")) - git.refresh(path_to_bundled_git_binary) - sio = io.BytesIO(data) sio.name = "/tmp/fuzzconfig.config" git_config = git.GitConfigParser(sio) diff --git a/fuzzing/fuzz-targets/fuzz_tree.py b/fuzzing/fuzz-targets/fuzz_tree.py index 7187c4a6f..4e2038add 100644 --- a/fuzzing/fuzz-targets/fuzz_tree.py +++ b/fuzzing/fuzz-targets/fuzz_tree.py @@ -23,15 +23,15 @@ import os import shutil +if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"): + path_to_bundled_git_binary = os.path.abspath(os.path.join(os.path.dirname(__file__), "git")) + os.environ["GIT_PYTHON_GIT_EXECUTABLE"] = path_to_bundled_git_binary + with atheris.instrument_imports(): import git def TestOneInput(data): - if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"): - path_to_bundled_git_binary = os.path.abspath(os.path.join(os.path.dirname(__file__), "git")) - git.refresh(path_to_bundled_git_binary) - fdp = atheris.FuzzedDataProvider(data) git_dir = "/tmp/.git" head_file = os.path.join(git_dir, "HEAD")