| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + "\\377\\377\\377\\377\\377\\377\\377\\377" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,40 @@ | |||
| 1 | + import atheris | ||
| 2 | + import sys | ||
| 3 | + import os | ||
| 4 | + import tempfile | ||
| 5 | + | ||
| 6 | + if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"): | ||
| 7 | + path_to_bundled_git_binary = os.path.abspath(os.path.join(os.path.dirname(__file__), "git")) | ||
| 8 | + os.environ["GIT_PYTHON_GIT_EXECUTABLE"] = path_to_bundled_git_binary | ||
| 9 | + | ||
| 10 | + with atheris.instrument_imports(): | ||
| 11 | + import git | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + def TestOneInput(data): | ||
| 15 | + fdp = atheris.FuzzedDataProvider(data) | ||
| 16 | + | ||
| 17 | + with tempfile.TemporaryDirectory() as temp_dir: | ||
| 18 | + repo = git.Repo.init(path=temp_dir) | ||
| 19 | + binsha = fdp.ConsumeBytes(20) | ||
| 20 | + mode = fdp.ConsumeInt(fdp.ConsumeIntInRange(0, fdp.remaining_bytes())) | ||
| 21 | + path = fdp.ConsumeUnicodeNoSurrogates(fdp.remaining_bytes()) | ||
| 22 | + | ||
| 23 | + try: | ||
| 24 | + blob = git.Blob(repo, binsha, mode, path) | ||
| 25 | + except AssertionError as e: | ||
| 26 | + if "Require 20 byte binary sha, got" in str(e): | ||
| 27 | + return -1 | ||
| 28 | + else: | ||
| 29 | + raise e | ||
| 30 | + | ||
| 31 | + _ = blob.mime_type | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + def main(): | ||
| 35 | + atheris.Setup(sys.argv, TestOneInput) | ||
| 36 | + atheris.Fuzz() | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + if __name__ == "__main__": | ||
| 40 | + main() | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments