Skip to content

quic: validate maxPayloadSize range - #67531

Open
christianaurichzm wants to merge 1 commit into
nodejs:mainfrom
christianaurichzm:quic-max-payload-size-range
Open

christianaurichzm wants to merge 1 commit into
nodejs:mainfrom
christianaurichzm:quic-max-payload-size-range

Conversation

@christianaurichzm

Copy link
Copy Markdown
Member

quic.connect() kills the process with SIGFPE when maxPayloadSize is 0:

$ node --experimental-quic -e "require('node:quic').connect('127.0.0.1:1', { alpn: 'x', maxPayloadSize: 0 })"
Floating point exception (core dumped)

The option goes unchecked into ngtcp2's max_tx_udp_payload_size, which must be between 1200 and 65527. ngtcp2 only asserts that, so a release build ends up dividing by zero in ngtcp2_cc_cubic_init(). This rejects values outside the range when the session options are parsed, for connect() and listen(), and documents it.

The new cases in test/parallel/test-quic-max-payload-size.mjs fail on main and pass with this change.

Refs: #65827

The maxPayloadSize option was copied into ngtcp2's
max_tx_udp_payload_size unchecked. ngtcp2 requires 1200 to 65527 and
only asserts it, so in a release build 0 gave the congestion controller
an empty initial window and the process died with SIGFPE in
ngtcp2_cc_cubic_init() when the connection was created. Values from 1
to 1199 were accepted and the session was destroyed before it opened.

Reject values outside that range when the session options are parsed,
for both connect() and listen().

Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/quic

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC transport implementation. labels Nov 16, 2026
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.68%. Comparing base (ca54b1f) to head (ca8eb09).
⚠️ Report is 43 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #67531    +/-   ##
========================================
  Coverage   90.68%   90.68%            
========================================
  Files         799      800     +1     
  Lines      280314   280461   +147     
  Branches    54133    54164    +31     
========================================
+ Hits       254204   254347   +143     
- Misses      16228    16238    +10     
+ Partials     9882     9876     -6     

see 49 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pimterry pimterry added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 17, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 17, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@Ethan-Arrowood Ethan-Arrowood left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@Ethan-Arrowood Ethan-Arrowood added author ready PRs with CI started, the required approvals, and no outstanding review comments. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. and removed dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. labels Nov 17, 2026
@christianaurichzm christianaurichzm added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 17, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 17, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@christianaurichzm christianaurichzm added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue PRs queued for automated landing through the Commit Queue. needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC transport implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants