Skip to content

tls: fix abort on negative zero sessionTimeout - #67661

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
JuHyeong424:tls-negative-zero
Nov 22, 2026
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
JuHyeong424:tls-negative-zero

Conversation

@JuHyeong424

Copy link
Copy Markdown
Contributor

validateInt32() accepts -0, but the binding asserts IsInt32(), which V8 reports as false for -0, so the process aborts. Coerce the value to +0 before passing it to setSessionTimeout().

Reproduction

require('tls').createSecureContext({ sessionTimeout: -0 });

On v26.13.1:

# node::crypto::SecureContext::SetSessionTimeout(...) at ../src/crypto/crypto_context.cc:2340
# Assertion failed: args[0]->IsInt32()

The abort cannot be caught with try/catch.

Same class of fix as #65888 (fs) and #67651 (os).

Added test/parallel/test-tls-negative-zero.js.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. tls Issues and PRs related to the tls subsystem. labels Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

validateInt32() accepts -0, but the binding asserts IsInt32(),
which V8 reports as false for -0, so the process aborts. Coerce
the value to +0 before passing it to setSessionTimeout().

Signed-off-by: JuHyeong424 <wkdwngud963@gmail.com>

@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.

lgtm; agree this is similar to the other recently merged #65888

@Ethan-Arrowood Ethan-Arrowood 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 20, 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 20, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.60%. Comparing base (dcaf43a) to head (2ae6a54).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67661      +/-   ##
==========================================
- Coverage   90.61%   90.60%   -0.01%     
==========================================
  Files         801      801              
  Lines      280966   280967       +1     
  Branches    54233    54224       -9     
==========================================
- Hits       254592   254581      -11     
- Misses      16566    16574       +8     
- Partials     9808     9812       +4     
Files with missing lines Coverage Δ
lib/internal/tls/secure-context.js 96.16% <100.00%> (+0.01%) ⬆️

... and 36 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.

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lgtm

@mcollina mcollina added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 21, 2026
@nodejs-github-bot
nodejs-github-bot merged commit a3596b6 into nodejs:main Nov 22, 2026
64 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in a3596b6

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 22, 2026
aduh95 pushed a commit that referenced this pull request Nov 23, 2026
validateInt32() accepts -0, but the binding asserts IsInt32(),
which V8 reports as false for -0, so the process aborts. Coerce
the value to +0 before passing it to setSessionTimeout().

Signed-off-by: JuHyeong424 <wkdwngud963@gmail.com>
PR-URL: #67661
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. tls Issues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants