Skip to content

Commit

Permalink
Merge pull request #1909 from DaveLak/attempt-two-fuzzing-fix-missing…
Browse files Browse the repository at this point in the history
…-git-in-clusterfuzz

Attempt 2 - Fix Missing Git Executable Causing ClusterFuzz Crash
  • Loading branch information
Byron committed Apr 27, 2024
2 parents 82bb3bb + dac3535 commit 797009d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions fuzzing/fuzz-targets/fuzz_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions fuzzing/fuzz-targets/fuzz_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 797009d

Please sign in to comment.