Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix Fuzzer Crash in ClusterFuzz Due to Missing Git Executable#1906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletionsfuzzing/fuzz-targets/fuzz_config.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,16 +20,21 @@
import atheris
import sys
import io
import os
from configparser import MissingSectionHeaderError, ParsingError

with atheris.instrument_imports():
from gitimportGitConfigParser
importgit


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 = GitConfigParser(sio)
git_config =git.GitConfigParser(sio)
try:
git_config.read()
except (MissingSectionHeaderError, ParsingError, UnicodeDecodeError):
Expand Down
11 changes: 7 additions & 4 deletionsfuzzing/fuzz-targets/fuzz_tree.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,11 +24,14 @@
import shutil

with atheris.instrument_imports():
from git.objects import Tree
from git.repo import Repo
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 All@@ -46,9 +49,9 @@ def TestOneInput(data):
os.mkdir(common_dir)
os.mkdir(objects_dir)

_repo = Repo("/tmp/")
_repo =git.Repo("/tmp/")

fuzz_tree = Tree(_repo, Tree.NULL_BIN_SHA, 0, "")
fuzz_tree =git.Tree(_repo,git.Tree.NULL_BIN_SHA, 0, "")
try:
fuzz_tree._deserialize(io.BytesIO(data))
except IndexError:
Expand Down
2 changes: 1 addition & 1 deletionfuzzing/oss-fuzz-scripts/build.sh
View file
Open in desktop
Original file line numberDiff line numberDiff 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"
compile_python_fuzzer "$fuzz_harness" --add-binary="$(command -v git):."

common_base_dictionary_filename="$SEED_DATA_DIR/__base.dict"
if [[ -r "$common_base_dictionary_filename" ]]; then
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp