Skip to content

dgram: fix abort on negative zero buffer size - #67662

Draft
JuHyeong424 wants to merge 1 commit into
nodejs:mainfrom
JuHyeong424:dgram-negative-zero
Draft

JuHyeong424 wants to merge 1 commit into
nodejs:mainfrom
JuHyeong424:dgram-negative-zero

Conversation

@JuHyeong424

Copy link
Copy Markdown

The size check accepts -0, but the binding asserts IsUint32(), which V8 reports as false for -0, so setRecvBufferSize(-0) and setSendBufferSize(-0) abort the process. Coerce the value to +0.

Reproduction

const s = require('dgram').createSocket('udp4');
s.bind(0, () => s.setRecvBufferSize(-0));

On v26.13.1:

# node::UDPWrap::BufferSize(...) at ../src/udp_wrap.cc:402
# Assertion failed: args[0]->IsUint32()

setSendBufferSize(-0) aborts the same way. The abort cannot be caught with try/catch.

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

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

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added dgram Issues and PRs related to UDP and the dgram module. needs-ci PRs that need a full CI run. 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.

The size check accepts -0, but the binding asserts IsUint32(),
which V8 reports as false for -0, so setRecvBufferSize(-0) and
setSendBufferSize(-0) abort the process. Coerce the value to +0.

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

Copy link
Copy Markdown
Member

The recommendations in:

advise you should tackle only one issue at a time and that you should not open any new PRs until your first PR has been approved.

You already have another unapproved PR #67661 open at this time which was opened a few minutes before this one.

Until the first PR has been approved and has landed in the main branch, GitHub classifies you as "first-time contributor". Each PR commit you push needs to be individually approved by team members to run in GitHub Actions CI. This causes delays for you as a contributor, and it adds to the work load for the team.

Waiting until the first PR has landed ensures that you as a contributor have experienced the complete process from PR submission to successful landing. After this has been completed, any new PRs or new commits to an existing PR are treated to rules for regular Contributors. GitHub Actions CI workflows are then run automatically without intervention by a team member.

@JuHyeong424
JuHyeong424 marked this pull request as draft November 20, 2026 16:18
@JuHyeong424

Copy link
Copy Markdown
Author

The recommendations in:

advise you should tackle only one issue at a time and that you should not open any new PRs until your first PR has been approved.

You already have another unapproved PR #67661 open at this time which was opened a few minutes before this one.

Until the first PR has been approved and has landed in the main branch, GitHub classifies you as "first-time contributor". Each PR commit you push needs to be individually approved by team members to run in GitHub Actions CI. This causes delays for you as a contributor, and it adds to the work load for the team.

Waiting until the first PR has landed ensures that you as a contributor have experienced the complete process from PR submission to successful landing. After this has been completed, any new PRs or new commits to an existing PR are treated to rules for regular Contributors. GitHub Actions CI workflows are then run automatically without intervention by a team member.

Thanks for the explanation. I’ve converted this to a draft and will mark it ready after #67661 lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dgram Issues and PRs related to UDP and the dgram module. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants