child_process: use stdio.fd even if it is 0
authorEvan Lucas <evanlucas@me.com>
Mon, 7 Sep 2015 17:25:25 +0000 (12:25 -0500)
committerRod Vagg <rod@vagg.org>
Tue, 8 Sep 2015 00:35:14 +0000 (10:35 +1000)
commit2c3939c9c066fba4018736b42bb50106c881aa31
treed0ac4215fae518dc1adc7cece4586a588ac4970c
parent03f900ab25b951800783a1a7a583280006fb1731
child_process: use stdio.fd even if it is 0

Previously, in _validateStdio we were using stdio.fd || stdio. If
stdio.fd was falsy (or 0 in the case of stdin), then the entire stdio
object would be passed which could cause a crash.

Fixes: https://github.com/nodejs/node/issues/2721
PR-URL: https://github.com/nodejs/node/pull/2727
Reviewed-By: silverwind - Roman Reiss <me@silverwind.io>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
lib/internal/child_process.js
test/parallel/test-child-process-validate-stdio.js