mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
tls: fix abort on negative zero sessionTimeout
validateInt32() accepts -0, but the binding asserts IsInt32(), which V8 reports as false for -0, so the process aborts. Coerce the value to +0 before passing it to setSessionTimeout(). Signed-off-by: JuHyeong424 <wkdwngud963@gmail.com> PR-URL: https://github.com/nodejs/node/pull/67661 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
This commit is contained in:
1 parent
b3c63d1c66
commit
399ffad09a
2 files changed
+11
-1
No files matched your search
@@ -328,7 +328,8 @@ function configSecureContext(context, options = kEmptyObject, name = 'options')
|
||||
|
||||
if (sessionTimeout !== undefined && sessionTimeout !== null) {
|
||||
validateInt32(sessionTimeout, `${name}.sessionTimeout`, 0);
|
||||
context.setSessionTimeout(sessionTimeout);
|
||||
// Coerce -0 to +0, which the binding does not treat as an Int32.
|
||||
context.setSessionTimeout(sessionTimeout | 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const tls = require('tls');
|
||||
|
||||
tls.createSecureContext({ sessionTimeout: -0 });
|
||||
Reference in new issue
Block a user