◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
9 changes: 7 additions & 2 deletions fuzzing/fuzz-targets/fuzz_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,21 @@
import atheris
import sys
import io
from configparser import MissingSectionHeaderError, ParsingError

with atheris.instrument_imports():
from git import GitConfigParser


def TestOneInput(data):
sio = io.BytesIO(data)
sio.name = "/tmp/fuzzconfig.config"
git_config = GitConfigParser(sio)
try:
git_config.read()
except (MissingSectionHeaderError, ParsingError, UnicodeDecodeError):
Expand Down
11 changes: 7 additions & 4 deletions fuzzing/fuzz-targets/fuzz_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@
import shutil

with atheris.instrument_imports():
from git.objects import Tree
from git.repo import Repo


def TestOneInput(data):
fdp = atheris.FuzzedDataProvider(data)
git_dir = "/tmp/.git"
head_file = os.path.join(git_dir, "HEAD")
Expand All @@ -46,9 +49,9 @@ def TestOneInput(data):
os.mkdir(common_dir)
os.mkdir(objects_dir)

_repo = Repo("/tmp/")

fuzz_tree = Tree(_repo, Tree.NULL_BIN_SHA, 0, "")
try:
fuzz_tree._deserialize(io.BytesIO(data))
except IndexError:
Expand Down
2 changes: 1 addition & 1 deletion fuzzing/oss-fuzz-scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ find "$SEED_DATA_DIR" \( -name '*_seed_corpus.zip' -o -name '*.options' -o -name

# Build fuzzers in $OUT.
find "$SRC/gitpython/fuzzing" -name 'fuzz_*.py' -print0 | while IFS= read -r -d '' fuzz_harness; do
compile_python_fuzzer "$fuzz_harness"

common_base_dictionary_filename="$SEED_DATA_DIR/__base.dict"
if [[ -r "$common_base_dictionary_filename" ]]; then
Expand Down
Toggle all file notes Toggle all file annotations