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

Commit6823e45

Browse files
committed
Use fuzzed data for all git.Blob arguments
This increases the edges reached by the fuzzer, making for a moreeffective test with higher coverage.
1 parent48abb1c commit6823e45

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

‎fuzzing/fuzz-targets/fuzz_blob.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ def TestOneInput(data):
1616

1717
withtempfile.TemporaryDirectory()astemp_dir:
1818
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-
)
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+
exceptAssertionErrorase:
26+
if"Require 20 byte binary sha, got"instr(e):
27+
return-1
28+
else:
29+
raisee
2630

2731
_=blob.mime_type
2832

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp