René's URL Explorer Experiment


Title: os: getPriority() and setPriority() abort the process when passed -0 · Issue #67648 · nodejs/node · GitHub

Open Graph Title: os: getPriority() and setPriority() abort the process when passed -0 · Issue #67648 · nodejs/node

X Title: os: getPriority() and setPriority() abort the process when passed -0 · Issue #67648 · nodejs/node

Description: Version v24.8.0 Platform Microsoft Windows 11 Home 10.0.26200 x64 Architecture: x64 Subsystem: os Testing: Reproduced and verified on Windows 11. Linux has not been tested. What steps will reproduce the bug? The issue occurs when negativ...

Open Graph Description: Version v24.8.0 Platform Microsoft Windows 11 Home 10.0.26200 x64 Architecture: x64 Subsystem: os Testing: Reproduced and verified on Windows 11. Linux has not been tested. What steps will reproduc...

X Description: Version v24.8.0 Platform Microsoft Windows 11 Home 10.0.26200 x64 Architecture: x64 Subsystem: os Testing: Reproduced and verified on Windows 11. Linux has not been tested. What steps will reproduc...

Opengraph URL: https://github.com/nodejs/node/issues/67648

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"os: getPriority() and setPriority() abort the process when passed -0","articleBody":"## Version \n`v24.8.0`\n\n## Platform\nMicrosoft Windows 11 Home 10.0.26200 x64\n\n- **Architecture:** x64\n- **Subsystem:** `os`\n- **Testing:** Reproduced and verified on Windows 11. Linux has not been tested.\n\n## What steps will reproduce the bug?\n\nThe issue occurs when negative zero (`-0`) is passed as a PID or priority argument to the Node.js `os` module.\n\nThe following examples reproduce the problem:\n\n```js\nconst os = require('node:os');\n\nos.getPriority(-0);\n```\n\n```js\nconst os = require('node:os');\n\nos.setPriority(-0);\n```\n\n```js\nconst os = require('node:os');\n\nos.setPriority(0, -0);\n```\n\nA realistic example is when a priority value is calculated dynamically:\n\n```js\nconst os = require('node:os');\n\nconst boostLevel = 0;\n\nos.setPriority(-boostLevel);\n```\n\nAlthough `boostLevel` is `0`, negating it produces JavaScript negative zero (`-0`).\n\n## How often does it reproduce? Is there a required condition?\n\nIt reproduces consistently whenever `-0` is passed as the PID or priority argument to the affected APIs.\n\nI tested all three examples on Windows 11 using Node.js `v24.8.0`. All three resulted in native assertion failures and process termination.\n\n## What is the expected behavior? Why is that expected?\n\nNegative zero is a valid JavaScript number and should be handled safely by the `os` module.\n\nSpecifically:\n\n1. `-0` passes the existing `validateInt32()` validation because `Number.isInteger(-0)` evaluates to `true`.\n2. Since JavaScript considers `-0` numerically equivalent to `0`, the API should handle it the same way as `0`.\n3. Alternatively, if negative zero is not supported for a particular argument, the API should throw a normal, catchable JavaScript exception rather than terminating the entire Node.js process.\n4. Native assertions should never cause a process abort when an input has already passed JavaScript-level argument validation.\n\nThere is an existing precedent in the `fs` module, fixed in #65888.\n\n## What do you see instead?\n\nInstead of returning normally or throwing a catchable JavaScript exception, Node.js terminates the process with a native assertion failure.\n\n### 1. `os.getPriority(-0)`\n\n```text\nvoid __cdecl node::os::GetPriority(const FunctionCallbackInfo\u003cValue> &) at src\\node_os.cc:398\nAssertion failed: args[0]->IsInt32()\n\n----- Native stack trace -----\n1: 00007FF7A6A4B11A DSA_meth_get_flags+198106\n2: 00007FF7A69A9605 node::MultiIsolatePlatform::DisposeIsolate+36069\n3: 000002559FDCF64D\n```\n\n### 2. `os.setPriority(-0)` and `os.setPriority(0, -0)`\n\n```text\nvoid __cdecl node::os::SetPriority(const FunctionCallbackInfo\u003cValue> &) at src\\node_os.cc:376\nAssertion failed: args[1]->IsInt32()\n\n----- Native stack trace -----\n1: 00007FF7A6A4B11A DSA_meth_get_flags+198106\n2: 00007FF7A69A944E node::MultiIsolatePlatform::DisposeIsolate+35630\n3: 00000200D8ACF64D\n```\n\nBoth `setPriority()` examples produce the same assertion failure.\n\n## Additional information\n\n### Root cause\n\nThe issue appears to originate from a mismatch between JavaScript-level integer validation and V8's internal integer representation.\n\nThe existing `validateInt32()` validation accepts negative zero because:\n\n```js\nNumber.isInteger(-0) === true\n```\n\nHowever, V8's `Value::IsInt32()` returns `false` for negative zero.\n\nThis happens because V8 represents `-0` as a heap number rather than an ordinary signed 32-bit integer.\n\nConsequently, when the validated argument reaches the native implementation in `src/node_os.cc`, the following assertion fails:\n\n```cpp\nCHECK(args[0]->IsInt32());\n```\n\nFor `setPriority()`, the corresponding assertion is:\n\n```cpp\nCHECK(args[1]->IsInt32());\n```\n\nThe assertion failure causes Node.js to abort instead of handling the argument safely.\n\n### Related precedent\n\nThe same kind of bug was fixed in `fs` in #65888, which coerces negative zero before it reaches the binding. There are also existing `test-*-negative-zero.js` tests for `fs`, `crypto`, `net`, `zlib` and `dns`.\n\n\n### Proposed fix\n\nOne possible solution is to normalize validated integer arguments before passing them to the native binding.\n\nFor example, in `lib/os.js`, coerce the relevant arguments to signed 32-bit integers using `| 0` before invoking the native binding:\n\n```js\nconst normalizedPid = pid | 0;\nconst normalizedPriority = priority | 0;\n```\n\nThis converts `-0` to `0`, ensuring that V8 receives a value compatible with the native `IsInt32()` assertion.\n\nThe fix should also include a regression test:\n\n`test/parallel/test-os-negative-zero.js`\n\nThe test should cover:\n\n- `os.getPriority(-0)`\n- `os.setPriority(-0)`\n- `os.setPriority(0, -0)`\n\nThe tests should verify that negative zero is handled safely and does not cause a native process abort.\n\n\n### AI disclosure\n\nI used AI assistance to help understand the Node.js codebase, investigate the potential root cause, and identify related negative-zero handling issues in other modules. I then independently reproduced the issue on Windows using Node.js `v24.8.0` and verified that all three examples trigger native assertion failures.\n","author":{"url":"https://github.com/zelalem61","@type":"Person","name":"zelalem61"},"datePublished":"2026-11-20T11:32:48Z","url":"https://github.com/nodejs/node/issues/67648"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:05f97a6d-345a-135d-fd94-553b9213ab47
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD938:2C4BED:2FF4179:3CEBBAC:6B01C689
html-safe-nonce3e79259836bd5c0c8379f7143f457c649c44f83edc8ae6204f5507f83e97c8b2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTM4OjJDNEJFRDoyRkY0MTc5OjNDRUJCQUM6NkIwMUM2ODkiLCJ2aXNpdG9yX2lkIjoiODQ5NzAyOTUzNzc0MDIxMTg0OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacd5ef0c4f0d8d457391f724e60b7db334ae8e116f3443ba7c50092ef44288393a
hovercard-subject-tagissue:6510587815
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/67648/issue_layout
twitter:imagehttps://opengraph.githubassets.com/233b76a92d5402ca56ac74cb51a41f73d03d3ac34ae7cc54b998cf6b2217828c/nodejs/node/issues/67648
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/233b76a92d5402ca56ac74cb51a41f73d03d3ac34ae7cc54b998cf6b2217828c/nodejs/node/issues/67648
og:image:altVersion v24.8.0 Platform Microsoft Windows 11 Home 10.0.26200 x64 Architecture: x64 Subsystem: os Testing: Reproduced and verified on Windows 11. Linux has not been tested. What steps will reproduc...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamezelalem61
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/67648#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F67648
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F67648
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/67648
Reloadhttps://github.com/nodejs/node/issues/67648
Reloadhttps://github.com/nodejs/node/issues/67648
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues637 (637)https://github.com/nodejs/node/issues
Pull requests665 (665)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/insights
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/67648
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/67648
#67651https://github.com/nodejs/node/pull/67651
os: getPriority() and setPriority() abort the process when passed -0https://github.com/nodejs/node/issues/67648#top
#67651https://github.com/nodejs/node/pull/67651
https://github.com/zelalem61
zelalem61https://github.com/zelalem61
on Nov 20, 2026https://github.com/nodejs/node/issues/67648#issue-6510587815
#65888https://github.com/nodejs/node/pull/65888
#65888https://github.com/nodejs/node/pull/65888
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/67648
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/67648
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.