Fix: infinite loop in parse_header_data() when HTTP/3 header length exceeds 65535 #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Description
When using QPACK for encoding and decoding in HTTP/3, lsquic encounters infinite loop during the process of decoding client request headers.
Loop Description
Infinite loop occurs in
parse_header_data()
. Loop is as follows:get_dst()
: Unable to store Huffman decoding results due to insufficient buffer space.lsqpack_huff_decode()
: Returns status code HUFF_DEC_END_DST, indicating the buffer is full.header_out_grow_buf()
: Attempts to calculate the required buffer growth size but restricts it to a maximum limit.h1h_prepare_decode()
: Fails to grow the buffer because the size remains unchanged.get_dst()
: Unable to store Huffman decoding results due to insufficient buffer space....... loop continues.
Loop Reason
During the decoding of HTTP/3 request header, if the buffer space is insufficient, a buffer expansion is triggered. However, even if the required expansion size exceeds 65535 bytes, the
header_out_grow_buf()
restricts the buffer size to 65535 bytes, resulting in no additional space being allocated. This causes the decoding process to enter a infinite loop.