diff options
author | Denys Otrishko <shishugi@gmail.com> | 2018-08-29 02:48:37 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-08-31 19:02:26 +0200 |
commit | 22789fd6d0a53a986073373136c269016d4267c8 (patch) | |
tree | e2fa325741c017ef44577bec815cd75e292a2c67 /test/parallel/test-child-process-spawn-typeerror.js | |
parent | c57ed415f5378c050f0784137864565804401f54 (diff) | |
download | android-node-v8-22789fd6d0a53a986073373136c269016d4267c8.tar.gz android-node-v8-22789fd6d0a53a986073373136c269016d4267c8.tar.bz2 android-node-v8-22789fd6d0a53a986073373136c269016d4267c8.zip |
child_process: fix handling of incorrect uid/gid in spawn
uid/gid must be uint32, which is asserted on a c++ side but wasn't
checked on a JS side and therefore resulted in a process crash.
Refs: https://github.com/nodejs/node/issues/22570
PR-URL: https://github.com/nodejs/node/pull/22574
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'test/parallel/test-child-process-spawn-typeerror.js')
-rw-r--r-- | test/parallel/test-child-process-spawn-typeerror.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/parallel/test-child-process-spawn-typeerror.js b/test/parallel/test-child-process-spawn-typeerror.js index 791cf02280..31a1867df9 100644 --- a/test/parallel/test-child-process-spawn-typeerror.js +++ b/test/parallel/test-child-process-spawn-typeerror.js @@ -33,7 +33,7 @@ const invalidArgValueError = common.expectsError({ code: 'ERR_INVALID_ARG_VALUE', type: TypeError }, 14); const invalidArgTypeError = - common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 10); + common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 12); assert.throws(function() { const child = spawn(invalidcmd, 'this is not an array'); @@ -76,6 +76,14 @@ assert.throws(function() { spawn(cmd, [], 1); }, invalidArgTypeError); +assert.throws(function() { + spawn(cmd, [], { uid: 2 ** 63 }); +}, invalidArgTypeError); + +assert.throws(function() { + spawn(cmd, [], { gid: 2 ** 63 }); +}, invalidArgTypeError); + // Argument types for combinatorics. const a = []; const o = {}; |