René's URL Explorer Experiment


Title: ffi: setFloat32()/setFloat64() coerce their value and discard a pending exception · Issue #65341 · nodejs/node · GitHub

Open Graph Title: ffi: setFloat32()/setFloat64() coerce their value and discard a pending exception · Issue #65341 · nodejs/node

X Title: ffi: setFloat32()/setFloat64() coerce their value and discard a pending exception · Issue #65341 · nodejs/node

Description: Version main (ad7a5b8) Platform Darwin 25.5.0 Darwin Kernel Version 25.5.0: Tue Jun 9 22:28:34 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T6041 arm64 Subsystem ffi What steps will reproduce the bug? // node --experimental-ffi repro....

Open Graph Description: Version main (ad7a5b8) Platform Darwin 25.5.0 Darwin Kernel Version 25.5.0: Tue Jun 9 22:28:34 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T6041 arm64 Subsystem ffi What steps will reproduce th...

X Description: Version main (ad7a5b8) Platform Darwin 25.5.0 Darwin Kernel Version 25.5.0: Tue Jun 9 22:28:34 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T6041 arm64 Subsystem ffi What steps will reproduce th...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ffi: setFloat32()/setFloat64() coerce their value and discard a pending exception","articleBody":"### Version\n\nmain (ad7a5b8302ae54b6e6dc77e03eabc5a3218dfb85)\n\n### Platform\n\n```text\nDarwin 25.5.0 Darwin Kernel Version 25.5.0: Tue Jun  9 22:28:34 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T6041 arm64\n```\n\n### Subsystem\n\nffi\n\n### What steps will reproduce the bug?\n\n```js\n// node --experimental-ffi repro.js\nconst { getRawPointer, setFloat64, getFloat64 } = require('node:ffi');\n\nconst ptr = getRawPointer(Buffer.alloc(8));\n\nfor (const value of ['1.5', true, {}, null]) {\n  setFloat64(ptr, 0, value);\n  console.log(`setFloat64(${String(value)}) ->`, getFloat64(ptr, 0));\n}\n\ntry {\n  setFloat64(ptr, 0, { valueOf() { throw new RangeError('boom'); } });\n} catch (err) {\n  console.log('valueOf threw ->', err.name, err.message);\n}\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways. `setFloat32()` behaves the same way.\n\n### What is the expected behavior? Why is that the expected behavior?\n\n`setFloat32()` and `setFloat64()` should reject a value that is not a `number`, like every other setter in the module, and they should not replace an exception the value itself threw.\n\nThe same `double` is type-checked on the argument path, where `ToFFIArgument()` requires `IsNumber()` and throws `Argument %s must be a double`, and the documentation says the setters \"validate the supplied JavaScript value against the target native type before writing it into memory\".\n\n### What do you see instead?\n\n```text\nsetFloat64(1.5) -> 1.5\nsetFloat64(true) -> 1\nsetFloat64([object Object]) -> NaN\nsetFloat64(null) -> 0\nvalueOf threw -> TypeError Value must be a number\n```\n\nThe integer branches of `SetValue\u003cT>()` require `IsNumber()` before any range check, but the floating-point branch calls `ToNumber()` and casts the result. When `ToNumber()` itself fails, the `ERR_INVALID_ARG_VALUE` overwrites the exception it left pending, so the `RangeError` never reaches the caller. `DataView.prototype.setFloat64()` and `Buffer.prototype.writeDoubleLE()` both propagate it.\n\nhttps://github.com/nodejs/node/blob/ad7a5b8302ae54b6e6dc77e03eabc5a3218dfb85/src/ffi/data.cc#L402-L411\n\n### Additional information\n\nThe setters write straight into native memory, so a `'1,5'` typo from a config file stores `NaN` in a struct field with no error at the call site. `setInt32()` throws on the same mistake.\n\n`DataView` and `Buffer` coerce here too, but they coerce for integers as well (`dv.setInt8(0, 300)` writes `44`), while `node:ffi` rejects those.\n\nThe integer validation, the float coercion and the documentation sentence all landed together in d0fa608c079, the floating-point branch has not been modified since, and I found no review comment about the difference in the pull requests that touched it.\n\nRefs: https://github.com/nodejs/node/pull/62072\nRefs: https://github.com/nodejs/node/pull/62762\nRefs: https://github.com/nodejs/node/pull/62858\nRefs: https://github.com/nodejs/node/pull/65342\n","author":{"url":"https://github.com/soulee-dev","@type":"Person","name":"soulee-dev"},"datePublished":"2026-08-17T00:27:49Z","url":"https://github.com/nodejs/node/issues/65341"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:f73006f8-019d-dc90-594f-3d88bedd51b7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8250:12D2BD:4E8D1B:6A8DD0:6AED1C0F
html-safe-noncee4ffeb71d644ff784271089adbac5eafcf263010bbfc42bbe3fbb9226192978c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjUwOjEyRDJCRDo0RThEMUI6NkE4REQwOjZBRUQxQzBGIiwidmlzaXRvcl9pZCI6IjU2NjE2NzkwMTE1MzY2NDEwNDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac85c907699ca50455f1dcbb056a60641f89c1d2318b04a6f6bbc9bad2cdcc97b2
hovercard-subject-tagissue:5167119249
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/65341/issue_layout
twitter:imagehttps://opengraph.githubassets.com/09b8fc0ff182c0c2db533fb143f2cb997b52295e495b715fbba55f81a433d168/nodejs/node/issues/65341
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/09b8fc0ff182c0c2db533fb143f2cb997b52295e495b715fbba55f81a433d168/nodejs/node/issues/65341
og:image:altVersion main (ad7a5b8) Platform Darwin 25.5.0 Darwin Kernel Version 25.5.0: Tue Jun 9 22:28:34 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T6041 arm64 Subsystem ffi What steps will reproduce th...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesoulee-dev
hostnamegithub.com
expected-hostnamegithub.com
None120085d0bcec1f427e3ab45302c8b95f873d26ad21984dc86d62ab2c10158f41
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
releasee12fd03aa775dceadc5a793c3a0791e43ca256bb
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/65341#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F65341
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%2F65341
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/65341
Reloadhttps://github.com/nodejs/node/issues/65341
Reloadhttps://github.com/nodejs/node/issues/65341
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues655 (655)https://github.com/nodejs/node/issues
Pull requests666 (666)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/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65341
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65341
#65342https://github.com/nodejs/node/pull/65342
ffi: setFloat32()/setFloat64() coerce their value and discard a pending exceptionhttps://github.com/nodejs/node/issues/65341#top
#65342https://github.com/nodejs/node/pull/65342
ffiIssues and PRs related to experimental Foreign Function Interface support.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22ffi%22
https://github.com/soulee-dev
soulee-devhttps://github.com/soulee-dev
on Aug 17, 2026https://github.com/nodejs/node/issues/65341#issue-5167119249
ad7a5b8https://github.com/nodejs/node/commit/ad7a5b8302ae54b6e6dc77e03eabc5a3218dfb85
node/src/ffi/data.cchttps://github.com/nodejs/node/blob/ad7a5b8302ae54b6e6dc77e03eabc5a3218dfb85/src/ffi/data.cc#L402-L411
ad7a5b8https://github.com/nodejs/node/commit/ad7a5b8302ae54b6e6dc77e03eabc5a3218dfb85
d0fa608https://github.com/nodejs/node/commit/d0fa608c07963448c41a0cbec8af9aa5db5da438
#62072https://github.com/nodejs/node/pull/62072
#62762https://github.com/nodejs/node/pull/62762
#62858https://github.com/nodejs/node/pull/62858
#65342https://github.com/nodejs/node/pull/65342
trivikrhttps://github.com/trivikr
ffiIssues and PRs related to experimental Foreign Function Interface support.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22ffi%22
on Aug 18, 2026https://github.com/nodejs/node/issues/65341#event-29596646687
nodejs-github-bothttps://github.com/nodejs-github-bot
on Aug 19, 2026https://github.com/nodejs/node/issues/65341#event-29707674830
ffi: validate the value passed to the float settershttps://github.com/nodejs/node/commit/f3a8f1aaf7c862f3c0fd083e8bb81894ea179124
f3a8f1ahttps://github.com/nodejs/node/commit/f3a8f1aaf7c862f3c0fd083e8bb81894ea179124
nodejs-github-bothttps://github.com/nodejs-github-bot
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#65342https://github.com/nodejs/node/pull/65342
on Aug 19, 2026https://github.com/nodejs/node/issues/65341#event-29707674951
aduh95https://github.com/aduh95
on Aug 25, 2026https://github.com/nodejs/node/issues/65341#event-30010177832
ffi: validate the value passed to the float settershttps://github.com/nodejs/node/commit/938aad4f0e4f863c5d0398a3993567a9d30dfbb5
938aad4https://github.com/nodejs/node/commit/938aad4f0e4f863c5d0398a3993567a9d30dfbb5
ffi: validate the value passed to the float settershttps://github.com/nodejs/node/commit/1fe7a1c33dee46943e985a052425a8422164513a
1fe7a1chttps://github.com/nodejs/node/commit/1fe7a1c33dee46943e985a052425a8422164513a
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/65341
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65341
ffiIssues and PRs related to experimental Foreign Function Interface support.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22ffi%22
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.