Skip to content

Commit 797009d

Browse files
authored
Merge pull request #1909 from DaveLak/attempt-two-fuzzing-fix-missing-git-in-clusterfuzz
Attempt 2 - Fix Missing Git Executable Causing ClusterFuzz Crash
2 parents 82bb3bb + dac3535 commit 797009d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

fuzzing/fuzz-targets/fuzz_config.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
import os
2424
from configparser import MissingSectionHeaderError, ParsingError
2525

26+
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
27+
path_to_bundled_git_binary = os.path.abspath(os.path.join(os.path.dirname(__file__), "git"))
28+
os.environ["GIT_PYTHON_GIT_EXECUTABLE"] = path_to_bundled_git_binary
29+
2630
with atheris.instrument_imports():
2731
import git
2832

2933

3034
def TestOneInput(data):
31-
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
32-
path_to_bundled_git_binary = os.path.abspath(os.path.join(os.path.dirname(__file__), "git"))
33-
git.refresh(path_to_bundled_git_binary)
34-
3535
sio = io.BytesIO(data)
3636
sio.name = "/tmp/fuzzconfig.config"
3737
git_config = git.GitConfigParser(sio)

fuzzing/fuzz-targets/fuzz_tree.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
import os
2424
import shutil
2525

26+
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
27+
path_to_bundled_git_binary = os.path.abspath(os.path.join(os.path.dirname(__file__), "git"))
28+
os.environ["GIT_PYTHON_GIT_EXECUTABLE"] = path_to_bundled_git_binary
29+
2630
with atheris.instrument_imports():
2731
import git
2832

2933

3034
def TestOneInput(data):
31-
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
32-
path_to_bundled_git_binary = os.path.abspath(os.path.join(os.path.dirname(__file__), "git"))
33-
git.refresh(path_to_bundled_git_binary)
34-
3535
fdp = atheris.FuzzedDataProvider(data)
3636
git_dir = "/tmp/.git"
3737
head_file = os.path.join(git_dir, "HEAD")

0 commit comments

Comments
 (0)