mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
3da003cc1c
Fix an issue where adding a session or keylog listener on a tlsSocket after it was destroyed caused a segfault. fixes: https://github.com/nodejs/node/issues/38133 fixes: https://github.com/nodejs/node/issues/38135 PR-URL: https://github.com/nodejs/node/pull/38180 Fixes: https://github.com/nodejs/node/issues/38133 Fixes: https://github.com/nodejs/node/issues/38135 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
23 lines
779 B
JavaScript
23 lines
779 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
// This test ensures that Node.js doesn't incur a segfault while
|
|
// adding session or keylog listeners after destroy.
|
|
// https://github.com/nodejs/node/issues/38133
|
|
// https://github.com/nodejs/node/issues/38135
|
|
|
|
const tls = require('tls');
|
|
const tlsSocketKeyLog = tls.connect('cause-error');
|
|
tlsSocketKeyLog.on('error', common.mustCall());
|
|
tlsSocketKeyLog.on('close', common.mustCall(() => {
|
|
tlsSocketKeyLog.on('keylog', common.mustNotCall());
|
|
}));
|
|
|
|
const tlsSocketSession = tls.connect('cause-error-2');
|
|
tlsSocketSession.on('error', common.mustCall());
|
|
tlsSocketSession.on('close', common.mustCall(() => {
|
|
tlsSocketSession.on('session', common.mustNotCall());
|
|
}));
|