-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/fuzz/fuzz_form.py b/fuzz/fuzz_form.py | ||
index 9a3d854..fbc6ad9 100644 | ||
--- a/fuzz/fuzz_form.py | ||
+++ b/fuzz/fuzz_form.py | ||
@@ -29,7 +29,7 @@ def parse_form_urlencoded(fdp: EnhancedDataProvider) -> None: | ||
|
||
|
||
def parse_multipart_form_data(fdp: EnhancedDataProvider) -> None: | ||
- boundary = "boundary" | ||
+ boundary = fdp.ConsumeRandomStringOfSize(16) or "boundary" | ||
header = {"Content-Type": f"multipart/form-data; boundary={boundary}"} | ||
body = ( | ||
f"--{boundary}\r\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git a/fuzz/helpers.py b/fuzz/helpers.py | ||
index 7fcd45c..d107cc1 100644 | ||
--- a/fuzz/helpers.py | ||
+++ b/fuzz/helpers.py | ||
@@ -1,9 +1,11 @@ | ||
import atheris | ||
|
||
- | ||
class EnhancedDataProvider(atheris.FuzzedDataProvider): | ||
def ConsumeRandomBytes(self) -> bytes: | ||
return self.ConsumeBytes(self.ConsumeIntInRange(0, self.remaining_bytes())) | ||
|
||
def ConsumeRandomString(self) -> str: | ||
return self.ConsumeUnicodeNoSurrogates(self.ConsumeIntInRange(0, self.remaining_bytes())) | ||
+ | ||
+ def ConsumeRandomStringOfSize(self, val: int) -> str: | ||
+ return self.ConsumeUnicodeNoSurrogates(self.ConsumeIntInRange(0, val)) |