Repository navigation
Conversation
| raise InvalidDataError(msg) | ||
|
|
||
| if self.pad_length and self.pad_length >= self.body_len: | ||
| if self.pad_length > self.body_len - padding_data_length - 4: |
There was a problem hiding this comment.
please add a comment to explain the origin of the -4 in this calculation.
|
Independently checked 726cc56 against its parent 632e309 on Linux / CPython 3.12. The same 22 stdlib unittest cases use the complete source modules: your 12 padded-HEADERS and two fixed-field-overlap cases, plus eight unchanged DATA/unpadded controls. The parent has eight passes, 12 assertion failures and two InvalidPaddingError exceptions on valid empty fragments; this head passes all 22. Source hashes stayed unchanged and both isolated runs cleaned up. This is scoped independent validation, not a rerun of the full upstream suite, external fixture corpus or CI. AI assistance was used to prepare the checks; I reviewed the source and results. |
Parsing a padded HEADERS frame drops the pad-length byte from
body_len. This also rejects a valid frame containing only padding and an empty header block. Separately, HEADERS with PRIORITY and PUSH_PROMISE can accept padding that overlaps their fixed fields.Keep the full HEADERS body length and compare padding against the bytes available after the fixed fields. Regression cases cover zero/nonzero padding, empty/nonempty header blocks, both priority modes, and overlapping fixed fields in both frame types.
All 14 regression cases fail before the fix. Full Python 3.12 suite: 162 passed, 100% branch coverage. Ruff and strict mypy pass. Includes a changelog entry.