HPACK/QPACK Huffman output cap is checked after unbounded Array.Resize doubling (bounded, hardening)
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
QPACK: the `decodedLength > _maxHeadersLength` cap (QPackDecoder.cs:638) runs AFTER Huffman.Decode, which grows its output via `Array.Resize(ref dstArray, dst.Length*2)` (Huffman.cs:714,781). Input is pre-capped to _maxHeadersLength (32KB) so the transient is bounded (~256KB/field) and rejected — not a DoS. But the cap being downstream of the growth is a clean hardening target: pass _maxHeadersLength into the decode/resize path and stop growing (throw) as soon as the decoded length would exceed the cap. Same post-hoc ordering in the HPACK path (HPackDecoder.cs:600). Line numbers per HEAD; please confirm against the target branch.
Contributor guide
Research direction
Start by reading QPackDecoder.cs:638, HPackDecoder.cs:600, and the Huffman.Decode growth paths at Huffman.cs:714 and 781, confirming the line locations on the target branch. Trace how _maxHeadersLength reaches decoding and verify that both HPACK and QPACK reject output before an expansion would exceed the cap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100