Skip to content

Fix HTTP/3 frame prefix allocation - #30

Closed
xintenseapple wants to merge 1 commit into
freenginx:defaultfrom
xintenseapple:fix/issue-21-http3-prefix-allocation
Closed

Fix HTTP/3 frame prefix allocation#30
xintenseapple wants to merge 1 commit into
freenginx:defaultfrom
xintenseapple:fix/issue-21-http3-prefix-allocation

Conversation

@xintenseapple

Copy link
Copy Markdown

Summary:

  • Allocate HTTP/3 DATA and trailing HEADERS frame prefixes using exact QUIC varint length accounting, including reused-buffer capacity checks.

Verification:

  • git diff --check; ./auto/configure --with-http_v3_module --with-http_ssl_module --without-http_rewrite_module --without-http_gzip_module --without-quic_bpf_module; make -j2

Fixes #21

@mdounin

mdounin commented Jun 11, 2026

Copy link
Copy Markdown
Member

I don't think that trying to calculate exact size needed for the particular body buffer being sent is the way to go, especially because buffers are reused, so we have to additionally check the size of obtained free buffers before trying to use them. Also, too small NGX_HTTP_V3_VARLEN_INT_LEN value might result in issues elsewhere: for example, right now the usage of NGX_HTTP_V3_VARLEN_INT_LEN in ngx_http_v3_send_goaway() is safe, but that's mostly because there are three varint values in the buffer, and two of them are guaranteed to be small. A better approach would be to simply bump NGX_HTTP_V3_VARLEN_INT_LEN to 8.

@mdounin mdounin closed this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP/3 DATA prefix can exceed its heap allocation

3 participants