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‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
importos
2424
fromconfigparserimportMissingSectionHeaderError, ParsingError
2525

26+
ifgetattr(sys, "frozen", False) andhasattr(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
withatheris.instrument_imports():
2731
importgit
2832

2933

3034
defTestOneInput(data):
31-
ifgetattr(sys, "frozen", False) andhasattr(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‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
importos
2424
importshutil
2525

26+
ifgetattr(sys, "frozen", False) andhasattr(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
withatheris.instrument_imports():
2731
importgit
2832

2933

3034
defTestOneInput(data):
31-
ifgetattr(sys, "frozen", False) andhasattr(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)