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

Commit fa7efaf

Browse files
trivikraduh95
authored andcommitted
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 PR-URL: #66371 Fixes: #66370 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
1 parent 11f8079 commit fa7efaf

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎src/node_ffi.cc‎

Lines changed: 6 additions & 3 deletions

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

Lines changed: 9 additions & 1 deletion

0 commit comments

Comments
 (0)