| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bc7bd22 commit f4b95cf
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,16 +20,21 @@ | |||
| 20 | 20 | import atheris | |
| 21 | 21 | import sys | |
| 22 | 22 | import io | |
| 23 | + import os | ||
| 23 | 24 | from configparser import MissingSectionHeaderError, ParsingError | |
| 24 | 25 | ||
| 25 | 26 | with atheris.instrument_imports(): | |
| 26 | - from git import GitConfigParser | ||
| 27 | + import git | ||
| 27 | 28 | ||
| 28 | 29 | ||
| 29 | 30 | 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 | + | ||
| 30 | 35 | sio = io.BytesIO(data) | |
| 31 | 36 | sio.name = "/tmp/fuzzconfig.config" | |
| 32 | - git_config = GitConfigParser(sio) | ||
| 37 | + git_config = git.GitConfigParser(sio) | ||
| 33 | 38 | try: | |
| 34 | 39 | git_config.read() | |
| 35 | 40 | except (MissingSectionHeaderError, ParsingError, UnicodeDecodeError): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,11 +24,14 @@ | |||
| 24 | 24 | import shutil | |
| 25 | 25 | ||
| 26 | 26 | with atheris.instrument_imports(): | |
| 27 | - from git.objects import Tree | ||
| 28 | - from git.repo import Repo | ||
| 27 | + import git | ||
| 29 | 28 | ||
| 30 | 29 | ||
| 31 | 30 | 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 | + | ||
| 32 | 35 | fdp = atheris.FuzzedDataProvider(data) | |
| 33 | 36 | git_dir = "/tmp/.git" | |
| 34 | 37 | head_file = os.path.join(git_dir, "HEAD") | |
@@ -46,9 +49,9 @@ def TestOneInput(data): | |||
| 46 | 49 | os.mkdir(common_dir) | |
| 47 | 50 | os.mkdir(objects_dir) | |
| 48 | 51 | ||
| 49 | - _repo = Repo("/tmp/") | ||
| 52 | + _repo = git.Repo("/tmp/") | ||
| 50 | 53 | ||
| 51 | - fuzz_tree = Tree(_repo, Tree.NULL_BIN_SHA, 0, "") | ||
| 54 | + fuzz_tree = git.Tree(_repo, git.Tree.NULL_BIN_SHA, 0, "") | ||
| 52 | 55 | try: | |
| 53 | 56 | fuzz_tree._deserialize(io.BytesIO(data)) | |
| 54 | 57 | except IndexError: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,7 @@ find "$SEED_DATA_DIR" \( -name '*_seed_corpus.zip' -o -name '*.options' -o -name | |||
| 14 | 14 | ||
| 15 | 15 | # Build fuzzers in $OUT. | |
| 16 | 16 | find "$SRC/gitpython/fuzzing" -name 'fuzz_*.py' -print0 | while IFS= read -r -d '' fuzz_harness; do | |
| 17 | - compile_python_fuzzer "$fuzz_harness" | ||
| 17 | + compile_python_fuzzer "$fuzz_harness" --add-binary="$(command -v git):." | ||
| 18 | 18 | ||
| 19 | 19 | common_base_dictionary_filename="$SEED_DATA_DIR/__base.dict" | |
| 20 | 20 | if [[ -r "$common_base_dictionary_filename" ]]; then | |
| Back | FazBrowse Home | New Git URL |
0 commit comments