Title: ffi: optimized calls skip BigInt range validation for pointer arguments · Issue #66370 · nodejs/node · GitHub
Open Graph Title: ffi: optimized calls skip BigInt range validation for pointer arguments · Issue #66370 · nodejs/node
X Title: ffi: optimized calls skip BigInt range validation for pointer arguments · Issue #66370 · nodejs/node
Description: Version main Platform macOS Subsystem ffi What steps will reproduce the bug? import { DynamicLibrary, suffix } from 'node:ffi'; const lib = new DynamicLibrary( `test/ffi/fixture_library/build/Release/ffi_test_library.${suffix}`); const f...
Open Graph Description: Version main Platform macOS Subsystem ffi What steps will reproduce the bug? import { DynamicLibrary, suffix } from 'node:ffi'; const lib = new DynamicLibrary( `test/ffi/fixture_library/build/Relea...
X Description: Version main Platform macOS Subsystem ffi What steps will reproduce the bug? import { DynamicLibrary, suffix } from 'node:ffi'; const lib = new DynamicLibrary( `test/ffi/fixture_library/bui...
Opengraph URL: https://github.com/nodejs/node/issues/66370
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ffi: optimized calls skip BigInt range validation for pointer arguments","articleBody":"### Version\n\nmain\n\n### Platform\n\n```text\nmacOS\n```\n\n### Subsystem\n\nffi\n\n### What steps will reproduce the bug?\n\n```js\nimport { DynamicLibrary, suffix } from 'node:ffi';\n\nconst lib = new DynamicLibrary(\n `test/ffi/fixture_library/build/Release/ffi_test_library.${suffix}`);\n\nconst fn = lib.getFunction('pointer_to_usize', {\n arguments: ['pointer', 'pointer'],\n return: 'u64',\n});\nfunction call(p) { return fn(p, 0n); }\n\nconst run = (label) => {\n for (const v of [-1n, 2n ** 64n + 5n]) {\n try { console.log(label, v, call(v)); } catch (e) { console.log(label, v, e.code); }\n }\n};\n\nrun('cold');\n%PrepareFunctionForOptimization(call);\ncall(1n);\n%OptimizeFunctionOnNextCall(call);\ncall(1n);\nrun('optimized');\n```\n\nRun with\n```console\nnode --allow-natives-syntax repro.js\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways\n\n### What is the expected behavior? Why is that the expected behavior?\n\nBoth calls throw `ERR_INVALID_ARG_VALUE` in both the cold and optimized runs.\n\n### What do you see instead?\n\n```text\ncold -1n ERR_INVALID_ARG_VALUE\ncold 18446744073709551621n ERR_INVALID_ARG_VALUE\noptimized -1n 18446744073709551615n\noptimized 18446744073709551621n 5n\n```\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-09-28T05:47:23Z","url":"https://github.com/nodejs/node/issues/66370"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f3775b19-ce29-46dd-5d37-b13331352599 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC56:10B16D:9E4811:D2A4F3:6AED314D |
| html-safe-nonce | d177341a04d3b5015d1d6e11123e876d07b0c9901a32674917d3848f90542717 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzU2OjEwQjE2RDo5RTQ4MTE6RDJBNEYzOjZBRUQzMTREIiwidmlzaXRvcl9pZCI6Ijg5MDIyNTEzMDExNjA0MzE5NDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 489683e6602734a3c41ecc2ebe3ec944d69a67bd61fcc9c63f1140b0421c93ba |
| hovercard-subject-tag | issue:5609974249 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/66370/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f77895db9e1a4297545a214f102556cfdaec226a8dd645d5928e528e25850176/nodejs/node/issues/66370 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f77895db9e1a4297545a214f102556cfdaec226a8dd645d5928e528e25850176/nodejs/node/issues/66370 |
| og:image:alt | Version main Platform macOS Subsystem ffi What steps will reproduce the bug? import { DynamicLibrary, suffix } from 'node:ffi'; const lib = new DynamicLibrary( `test/ffi/fixture_library/build/Relea... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trivikr |
| hostname | github.com |
| expected-hostname | github.com |
| None | e51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ebb7b901cc154ecc179a44f266fcf69f343b30 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width