-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spawnSync's SyncProcessRunner::CopyJsStringArray segfaults with bad getter #9821
Comments
Does this still apply when using |
Thanks for filtering through these @mscdex. I am not completely sure. It may be; our process has been to find the low-level bugs and see if we can trigger them from the top-level lib vs. |
The reason I ask is because |
I feel like this is probably not |
here you go: const spawn = require('child_process').spawnSync;
const args = [ '-a' ];
let doit = false;
Object.defineProperty(args, 1, {
get: () => {
if (doit) {
return 3
}
return '3';
},
set: () => {
doit = true;
},
enumerable: true
});
args.slice = () => {
return args;
};
spawn('ls', args); |
@mscdex I completely agree. I guess I'm arguing for a move towards slightly more defensive coding in the binding layer. (But I obviously understand that there are many other efforts and not enough time. I do appreciate the work you all are doing!) |
I think there has been a general trend towards catching bad inputs early, in the js layer. Arguably, the c++ layer should still never fault, but its hard to maintain code paths that aren't reachable. I think the availability of the bindings is itself something node is trying to get rid of (making it only available, like the internal js modules, with a command line flag). I think doing this is blocked by deps in npm, maybe its time to start adding deprecation notices to use of |
Is anyone working on this? Would it make sense to add a |
This seems to abort on an assertion rather than segfault so we'll close it out. |
Similar to #9820, the underlying binding code that is used by spawnSync can
segfault when called with objects/array that have "evil" getters/setters. The
following code shows an example of this:
May be worth again ensuring that all arguments are strings before calling into
the binding code.
The text was updated successfully, but these errors were encountered: