quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.57k stars 364 forks source link

Don't double-count buffer consumption in close length checks #1768

Closed Ralith closed 4 months ago

Ralith commented 4 months ago

PacketBuilder::max_size previously subtracted out the start index and header size of the packet, and therefore described the admissible size of the packet's frames. However, most of our logic operates in terms of absolute buffer positions instead. This was confusing, and led to erroneous double-counting of space use in close packets.

Discovered while drafting #1767.