Commit d75fdd9
committed
child_process: improve killSignal validations
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.
PR-URL: #10423
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>1 parent a5f91ab commit d75fdd9Copy full SHA for d75fdd9
File tree
Expand file treeCollapse file tree
4 files changed
+54
-40
lines changedOpen diff view settings
Filter options
- lib
- internal
- test/parallel
Expand file treeCollapse file tree
4 files changed
+54
-40
lines changedOpen diff view settings
Collapse file
+7-23Lines changed: 7 additions & 23 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | | - |
| 25 | + |
26 | 26 | |
27 | | - |
28 | 27 | |
29 | 28 | |
30 | 29 | |
| ||
181 | 180 | |
182 | 181 | |
183 | 182 | |
| 183 | + |
| 184 | + |
184 | 185 | |
185 | 186 | |
186 | 187 | |
| ||
332 | 333 | |
333 | 334 | |
334 | 335 | |
335 | | - |
| 336 | + |
336 | 337 | |
337 | 338 | |
338 | 339 | |
| ||
474 | 475 | |
475 | 476 | |
476 | 477 | |
477 | | - |
478 | | - |
479 | | - |
480 | | - |
481 | | - |
482 | | - |
483 | | - |
484 | | - |
485 | | - |
486 | | - |
487 | | - |
488 | | - |
489 | 478 | |
490 | 479 | |
491 | 480 | |
| ||
506 | 495 | |
507 | 496 | |
508 | 497 | |
509 | | - |
| 498 | + |
510 | 499 | |
511 | 500 | |
512 | 501 | |
| ||
632 | 621 | |
633 | 622 | |
634 | 623 | |
635 | | - |
| 624 | + |
636 | 625 | |
637 | | - |
638 | | - |
639 | | - |
640 | | - |
| 626 | + |
641 | 627 | |
642 | 628 | |
643 | 629 | |
644 | | - |
645 | | - |
646 | 630 | |
Collapse file
lib/internal/child_process.js
Copy file name to clipboardExpand all lines: lib/internal/child_process.js+3-14Lines changed: 3 additions & 14 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
5 | 5 | |
6 | 6 | |
7 | 7 | |
8 | | - |
9 | 8 | |
10 | 9 | |
11 | 10 | |
| ||
17 | 16 | |
18 | 17 | |
19 | 18 | |
| 19 | + |
20 | 20 | |
21 | 21 | |
22 | 22 | |
| ||
362 | 362 | |
363 | 363 | |
364 | 364 | |
365 | | - |
366 | | - |
367 | | - |
368 | | - |
369 | | - |
370 | | - |
371 | | - |
372 | | - |
373 | | - |
374 | | - |
375 | | - |
376 | | - |
377 | | - |
| 365 | + |
| 366 | + |
378 | 367 | |
379 | 368 | |
380 | 369 | |
|
Collapse file
+26Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | 2 | |
3 | 3 | |
| 4 | + |
4 | 5 | |
5 | 6 | |
6 | 7 | |
| ||
179 | 180 | |
180 | 181 | |
181 | 182 | |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | + |
| 191 | + |
| 192 | + |
| 193 | + |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | + |
| 198 | + |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
Collapse file
test/parallel/test-child-process-spawnsync-validation-errors.js
Copy file name to clipboardExpand all lines: test/parallel/test-child-process-spawnsync-validation-errors.js+18-3Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2 | 2 | |
3 | 3 | |
4 | 4 | |
| 5 | + |
5 | 6 | |
6 | 7 | |
7 | 8 | |
| ||
184 | 185 | |
185 | 186 | |
186 | 187 | |
187 | | - |
188 | 188 | |
189 | 189 | |
190 | 190 | |
191 | 191 | |
192 | 192 | |
193 | | - |
194 | | - |
195 | 193 | |
196 | 194 | |
197 | 195 | |
198 | 196 | |
199 | 197 | |
200 | 198 | |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
| 208 | + |
| 209 | + |
| 210 | + |
| 211 | + |
| 212 | + |
| 213 | + |
| 214 | + |
| 215 | + |
201 | 216 | |
0 commit comments