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.

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

355355 ):
356356 """Create a new parser instance.
357357
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.
359359 :param content_length: Expected input size in bytes, or -1 if unknown.
360360 :param max_header_size: Maximum length of a single header line (name and value).
361361 :param max_header_count: Maximum number of headers per segment.
372372 self.max_segment_size = max_segment_size
373373 self.max_segment_count = max_segment_count
374374 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")
375380
376381 # Internal parser state
377382 self._delimiter = b"\r\n--" + self.boundary

The check that tells the two apart

failpass·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