Skip to content

child_process: improve killSignal validations

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

child_process

Description of change

As it is, the killSignal is just retrieved from an object and used. If the signal passed is actually one of the inherited properties of that object, Node.js will die. For example,

➜  node -e "child_process.spawnSync('ls', {killSignal: 'toString'})"
Assertion failed: (0), function uv_close, file ....core.c, line 166.
[1]    58938 abort      node -e "child_process.spawnSync(...)"
  1. This patch makes sure that the signal is actually a own property of the constants object.

  2. Extends the killSignal validation to all the other functions.

Merge request reports

Loading