Commit 2a044b9
HPACKDecoder: reject more than two table size updates per header block (#551)
RFC 7541 § 4.2 specifies that an encoder emits at most two dynamic table
size updates between two header blocks (the smallest size reached, then
the final size). The decoder enforced placement - updates must precede
the first header - but put no upper bound on their count, so a block of
arbitrarily many 0x20 bytes followed by a header was accepted. This is a
conformance gap. It is not a DoS: setting an already-empty table to 0 is
O(1).
Modifications:
- Count consecutive table size updates in decodeHeaders(from:) and throw
IllegalDynamicTableSizeChange once a third is seen.
- Extend the existing § 4.2 comment to cite the at-most-two rule.
- Add tests covering the two-accepted and three-rejected cases.
Result:
Header blocks with more than two dynamic table size updates are rejected
as malformed, matching RFC 7541 § 4.2.
Co-authored-by: George Barnett <gbarnett@apple.com>1 parent 634d078 commit 2a044b9
2 files changed
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
138 | 151 | | |
139 | 152 | | |
140 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
551 | 551 | | |
552 | 552 | | |
553 | 553 | | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
554 | 576 | | |
555 | 577 | | |
556 | 578 | | |
| |||
0 commit comments