File tree Expand file tree Collapse file tree 4 files changed +32
-0
lines changed
projects/python-multipart Expand file tree Collapse file tree 4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -19,4 +19,5 @@ RUN apt-get update && apt-get install -y make autoconf automake libtool
19
19
RUN git clone --depth 1 https://github.com/Kludex/python-multipart python-multipart
20
20
RUN python3 -m pip install --upgrade pip
21
21
WORKDIR python-multipart
22
+ COPY *.patch $SRC/python-multipart
22
23
COPY build.sh *.options $SRC/
Original file line number Diff line number Diff line change 15
15
#
16
16
# ###############################################################################
17
17
18
+ git apply $SRC /python-multipart/* .patch
18
19
python3 -m pip install ' .[dev]'
19
20
for fuzzer in $( find $SRC -name " fuzz_*.py" ) ; do
20
21
compile_python_fuzzer $fuzzer
Original file line number Diff line number Diff line change
1
+ diff --git a/fuzz/fuzz_form.py b/fuzz/fuzz_form.py
2
+ index 9a3d854..fbc6ad9 100644
3
+ --- a/fuzz/fuzz_form.py
4
+ +++ b/fuzz/fuzz_form.py
5
+ @@ -29,7 +29,7 @@ def parse_form_urlencoded(fdp: EnhancedDataProvider) -> None:
6
+
7
+
8
+ def parse_multipart_form_data(fdp: EnhancedDataProvider) -> None:
9
+ - boundary = "boundary"
10
+ + boundary = fdp.ConsumeRandomStringOfSize(16) or "boundary"
11
+ header = {"Content-Type": f"multipart/form-data; boundary={boundary}"}
12
+ body = (
13
+ f"--{boundary}\r\n"
Original file line number Diff line number Diff line change
1
+ diff --git a/fuzz/helpers.py b/fuzz/helpers.py
2
+ index 7fcd45c..d107cc1 100644
3
+ --- a/fuzz/helpers.py
4
+ +++ b/fuzz/helpers.py
5
+ @@ -1,9 +1,11 @@
6
+ import atheris
7
+
8
+ -
9
+ class EnhancedDataProvider(atheris.FuzzedDataProvider):
10
+ def ConsumeRandomBytes(self) -> bytes:
11
+ return self.ConsumeBytes(self.ConsumeIntInRange(0, self.remaining_bytes()))
12
+
13
+ def ConsumeRandomString(self) -> str:
14
+ return self.ConsumeUnicodeNoSurrogates(self.ConsumeIntInRange(0, self.remaining_bytes()))
15
+ +
16
+ + def ConsumeRandomStringOfSize(self, val: int) -> str:
17
+ + return self.ConsumeUnicodeNoSurrogates(self.ConsumeIntInRange(0, val))
You can’t perform that action at this time.
0 commit comments