From b0337d83cc4a1d8737cc2c785a10a20f35753e78 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Tue, 23 May 2017 15:38:53 -0400 Subject: [PATCH] child_process: don't send invalid handles over IPC --- lib/internal/child_process.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index abd4b16d120dc3..999f7d28ffa12a 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -610,10 +610,12 @@ function setupChannel(target, channel) { handle, options); - // If handle was sent twice, or it is impossible to get native handle - // out of it - just send a text without the handle. - if (!handle) - message = message.msg; + // If it is impossible to get a handle, then something unexpected likely + // happened. For example, a socket may have closed while waiting in the + // _handleQueue. + if (!handle) { + return true; + } // Update simultaneous accepts on Windows if (obj.simultaneousAccepts) {