Version
main
Platform
Subsystem
ffi
What steps will reproduce the bug?
repro.c
#include <stdint.h>
int add(int a, int b) {
return a + b;
}
repro.js
import { DynamicLibrary, suffix } from 'node:ffi';
const name = process.argv[2] || 'path';
const lib = new DynamicLibrary(`./repro.${suffix}`);
const owner = name === 'functions' ? DynamicLibrary.prototype : lib;
const getter = Object.getOwnPropertyDescriptor(owner, name).get;
getter.call({});
Commands to run:
cc -dynamiclib repro.c -o repro.dylib
node --experimental-ffi repro.js path
node --experimental-ffi repro.js symbols
node --experimental-ffi repro.js functions
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
It should instead throw a JavaScript TypeError, such as “Illegal invocation” or “Invalid receiver,” without terminating the process.
What do you see instead?
Each extracted getter crashes the Node.js process when called with an incompatible receiver, with either segmentation fault or bus error
Additional information
No response
Version
main
Platform
Subsystem
ffi
What steps will reproduce the bug?
repro.crepro.jsCommands to run:
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
It should instead throw a JavaScript
TypeError, such as “Illegal invocation” or “Invalid receiver,” without terminating the process.What do you see instead?
Each extracted getter crashes the Node.js process when called with an incompatible receiver, with either
segmentation faultorbus errorAdditional information
No response