Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 48abb1c commit 6823e45Copy full SHA for 6823e45
1 file changed
fuzzing/fuzz-targets/fuzz_blob.py
@@ -16,13 +16,17 @@ def TestOneInput(data):
16
17
with tempfile.TemporaryDirectory() as temp_dir:
18
repo = git.Repo.init(path=temp_dir)
19
- blob = git.Blob(
20
- repo,
21
- **{
22
- "binsha": git.Blob.NULL_BIN_SHA,
23
- "path": fdp.ConsumeUnicodeNoSurrogates(fdp.remaining_bytes()),
24
- },
25
- )
+ binsha = fdp.ConsumeBytes(20)
+ mode = fdp.ConsumeInt(fdp.ConsumeIntInRange(0, fdp.remaining_bytes()))
+ path = fdp.ConsumeUnicodeNoSurrogates(fdp.remaining_bytes())
+
+ try:
+ blob = git.Blob(repo, binsha, mode, path)
+ 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
0 commit comments