Whole file
defnull/multipart
The author described this change as “change: Raise ParserStateError on invalid boundaries.”. It counts as a record because the check below fails on the code as it stood at 4e0b303e0 and passes on 8cef6c08f, with nothing else changed between the two runs.
Projectdefnull/multipart
Fix saved2026-03-09
Sharing licenceMIT · LICENSE
Change size+6 −1
What the code was meant to do, written into the code itself as a save note
change: Raise ParserStateError on invalid boundaries.
The change
| 355 | 355 | ): | |
| 356 | 356 | """Create a new parser instance. | |
| 357 | 357 | ||
| 358 | - | :param boundary: The multipart boundary as found in the Content-Type header. | |
| 358 | + | :param boundary: A valid multipart boundary as found in the Content-Type header. | |
| 359 | 359 | :param content_length: Expected input size in bytes, or -1 if unknown. | |
| 360 | 360 | :param max_header_size: Maximum length of a single header line (name and value). | |
| 361 | 361 | :param max_header_count: Maximum number of headers per segment. | |
| ⋯ | |||
| 372 | 372 | self.max_segment_size = max_segment_size | |
| 373 | 373 | self.max_segment_count = max_segment_count | |
| 374 | 374 | self.strict = strict | |
| 375 | + | ||
| 376 | + | if not self.boundary: | |
| 377 | + | raise ParserStateError("Empty boundary") | |
| 378 | + | if b"\n" in self.boundary: | |
| 379 | + | raise ParserStateError("Invalid characters in boundary") | |
| 375 | 380 | ||
| 376 | 381 | # Internal parser state | |
| 377 | 382 | self._delimiter = b"\r\n--" + self.boundary | |
The check that tells the two apart
fail→pass·test/test_push_parser.py::TestPushParser::test_init_bad_boundary
Check file test/test_push_parser.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it4e0b303e07ad59a485653243274ee38b6cd541af
Broken version dated2026-02-27
Modulemultipart
Units changedPushMultipartParser
Fingerprinte821f804675e5b33
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in defnull/multipart
- 2025-07-26fix: Hardened header parsing.
- 2025-01-21MultipartPart
- 2024-09-28fix: Allow empty segment names
- 2024-08-26parse_form_data
- 2024-08-26fix: Properly handle completely empty input stream.