GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix Fuzzer Crash in ClusterFuzz Due to Missing Git Executable by DaveLak · Pull Request #1906 · gitpython-developers/GitPython

Conversation

@DaveLak

@DaveLak DaveLak commented Apr 22, 2024

Copy link
Copy Markdown
Contributor

A Git executable is not globally available in the ClusterFuzz container
environment where OSS-Fuzz executes fuzz tests, causing an error in the fuzz
harnesses when GitPython attempts to initialize, crashing the tests before they
can run.

To avoid this issue, we bundle the git binary that is available in the OSS-Fuzz
build container with the fuzz harness via Pyinstaller's --add-binary flag in
build.sh and use GitPython's git.refresh(<full-path-to-git-executable>)
method inside a Pyinstaller runtime check to initialize GitPython with the
bundled Git executable when running from the bundled application.

In all other execution environments, we assume a git executable is available
globally.

Fixes:

  • Fuzz Tests Are Crashing at Start-up on ClusterFuzz #1905
  • gitpython: Failing on every run google/oss-fuzz#10600

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@DaveLak
Fix Fuzzer Crash in ClusterFuzz Due to Missing Git Executable
f4b95cf
A Git executable is not globally available in the ClusterFuzz container
environment where OSS-Fuzz executes fuzz tests, causing an error in the fuzz
harnesses when GitPython attempts to initialize, crashing the tests before they
can run.

To avoid this issue, we bundle the `git` binary that is available in the OSS-Fuzz
build container with the fuzz harness via Pyinstaller's `--add-binary` flag in
`build.sh` and use GitPython's `git.refresh(<full-path-to-git-executable>)`
method inside a Pyinstaller runtime check to initialize GitPython with the
bundled Git executable when running from the bundled application.

In all other execution environments, we assume a `git` executable is available
globally.

Fixes:
- gitpython-developers#1905
- google/oss-fuzz#10600
@DaveLak DaveLak mentioned this pull request Apr 22, 2024
Fuzz Tests Are Crashing at Start-up on ClusterFuzz #1905
Closed
1 task done
Byron
Byron approved these changes Apr 23, 2024
View reviewed changes

@Byron Byron left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the fix!

I wonder how this could ever work on OSS-fuzz.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Byron
Byron merged commit 0552b83 into gitpython-developers:main Apr 23, 2024
@DaveLak

DaveLak commented Apr 23, 2024

Copy link
Copy Markdown
Contributor Author

I wonder how this could ever work on OSS-fuzz.

Different images everywhere 🫣

Byron reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

DaveLak added a commit to DaveLak/GitPython that referenced this pull request Apr 26, 2024
@DaveLak
Attempt 2 - Fix Missing Git Executable Causing ClusterFuzz Crash
dac3535
This is a second attempt at gitpython-developers#1906 and should resolve:
- gitpython-developers#1905
- google/oss-fuzz#10600

PR gitpython-developers#1906 had the right idea but wrong implementation, and the differences between
the ClusterFuzz image that it was supposed to fix and the OSS-Fuzz image where
the fix was tested led to the issue not being fully resolved.

The root cause of the issue is the same: A Git executable is not globally
available in the ClusterFuzz container environment where OSS-Fuzz executes
fuzz tests.

 gitpython-developers#1906 attempted to fix the issue by bundling the Git binary and using
GitPython's `git.refresh(<full-path-to-git-executable>)` method to set it
inside the `TestOneInput` function of the test harness.

However, GitPython attempts to set the binary at import time via its `__init__`
hook, and crashes the test if no executable is found during the import.

This issue is fixed here by setting the environment variable that GitPython
looks in before importing it, so it's available for the import. This was tested
by setting the `$PATH` to an empty string inside the test files, which
reproduced the crash, then adding the changes introduced here with `$PATH` still
empty, which avoided the crash indicating that the bundled Git executable is
working as expected.
@DaveLak DaveLak mentioned this pull request Apr 26, 2024
Attempt 2 - Fix Missing Git Executable Causing ClusterFuzz Crash #1909
Merged
@DaveLak
DaveLak deleted the fuzzing-fix-missing-git-in-clusterfuzz branch April 29, 2024 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Byron Byron Byron approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@DaveLak @Byron
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.