Title: ffi: buffer/arraybuffer args reject BigInt pointers in multi-argument fast signatures · Issue #64963 · nodejs/node · GitHub
Open Graph Title: ffi: buffer/arraybuffer args reject BigInt pointers in multi-argument fast signatures · Issue #64963 · nodejs/node
X Title: ffi: buffer/arraybuffer args reject BigInt pointers in multi-argument fast signatures · Issue #64963 · nodejs/node
Description: Version main Platform Linux Subsystem ffi What steps will reproduce the bug? repro.c #include
Open Graph Description: Version main Platform Linux Subsystem ffi What steps will reproduce the bug? repro.c #include
X Description: Version main Platform Linux Subsystem ffi What steps will reproduce the bug? repro.c #include <stdint.h> uint64_t ptr_one(void *p) { return (uint64_t)(uintptr_t)p; } uint64_t ptr_two(void *p,...
Opengraph URL: https://github.com/nodejs/node/issues/64963
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ffi: buffer/arraybuffer args reject BigInt pointers in multi-argument fast signatures","articleBody":"### Version\n\nmain\n\n### Platform\n\n```text\nLinux\n```\n\n### Subsystem\n\nffi\n\n### What steps will reproduce the bug?\n\n`repro.c`\n```c\n#include \u003cstdint.h>\n\nuint64_t ptr_one(void *p) { return (uint64_t)(uintptr_t)p; }\nuint64_t ptr_two(void *p, uint64_t extra) { return (uint64_t)(uintptr_t)p + extra; }\n```\n\nCompile it with\n```sh\n$ cc -shared -fPIC -o repro.so repro.c\n```\n\n`repro.js`\n```js\nimport { dlopen } from 'node:ffi';\n\nconst { lib, functions } = dlopen(new URL('repro.so', import.meta.url).pathname, {\n ptr_one: { arguments: ['buffer'], return: 'u64' },\n ptr_two: { arguments: ['buffer', 'u64'], return: 'u64' },\n});\n\nfor (const [label, call] of [\n ['1-arg buffer(10n) ', () => functions.ptr_one(10n)],\n ['2-arg buffer(10n, 0n)', () => functions.ptr_two(10n, 0n)],\n]) {\n try {\n console.log(label, '->', call());\n } catch (err) {\n console.log(label, '-> THREW', err.code, '-', err.message);\n }\n}\n\nlib.close();\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\n```console\n1-arg buffer(10n) -> 10n\n2-arg buffer(10n, 0n) -> 10n\n```\n\nExpected both to return `10n`, matching the SB/libffi paths which accept BigInt pointers at every arity; if rejection were intended it should be `ERR_INVALID_ARG_VALUE` with an `Argument N` prefix like the rest of the module.\n\n### What do you see instead?\n\n```console\n1-arg buffer(10n) -> 10n\n2-arg buffer(10n, 0n) -> THREW ERR_INVALID_ARG_TYPE - The first argument must be a Buffer, ArrayBuffer, or ArrayBufferView\n```\n\nThe one-argument signature returns `10n` while the identical buffer type in a two-argument signature throws `ERR_INVALID_ARG_TYPE`.\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-08-02T16:33:30Z","url":"https://github.com/nodejs/node/issues/64963"}
| 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:52a60a0b-a01b-7cd4-9121-1d195eb61317 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B606:1F5F5F:75A7E4:9C6C9A:6AED2383 |
| html-safe-nonce | 357dcd65926c9a57b8cf41b825f2a7255fe6acf263d446aebbf51c29346c0abe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjA2OjFGNUY1Rjo3NUE3RTQ6OUM2QzlBOjZBRUQyMzgzIiwidmlzaXRvcl9pZCI6IjE2NjY1Mzc1MzI3MjQ5NDU3OTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 25d8f65d7b76dde7f57d15a6e8822508470e8c1b230962b89c1cfa63ae08c53b |
| hovercard-subject-tag | issue:5043435155 |
| 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/64963/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8a8a87dbf9da8100bda1fe893e1cf0a76939927311ee304a40cbc597de21bc73/nodejs/node/issues/64963 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8a8a87dbf9da8100bda1fe893e1cf0a76939927311ee304a40cbc597de21bc73/nodejs/node/issues/64963 |
| og:image:alt | Version main Platform Linux Subsystem ffi What steps will reproduce the bug? repro.c #include |
| 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 | e3e0f7f63e50c6fe879198a93a0a023a648ecc0a5e9bc3b5e033ac57172237e6 |
| 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 | 707a24b346ac8a82878b9c084efaa38a997660cb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width