ffi: validate pointer ranges in optimized calls · nodejs/node@4896eb3 · GitHub
Skip to content

Commit 4896eb3

Browse files
committed
ffi: validate pointer ranges in optimized calls
On x64 SysV and arm64, a Fast API signature with two or more arguments that uses only pointer and float types got no JS wrapper. V8 then truncated pointer BigInts silently. With `-1n` or `2n ** 64n + 5n`, cold calls threw ERR_INVALID_ARG_VALUE, while optimized calls passed 0xffffffffffffffff or 5 to native code. Use the argument wrapper for any signature with a pointer argument. Signed-off-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Assisted-by: claude:opus-5.5
1 parent 75e4bbe commit 4896eb3

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎src/node_ffi.cc‎

Lines changed: 3 additions & 0 deletions

‎test/ffi/test-ffi-fast-integer-validation.js‎

Lines changed: 9 additions & 1 deletion

0 commit comments

Comments
 (0)