node/test/parallel/test-ttywrap-stack.js
Thomas 6fb32ac255
src: prevent crash in TTYWrap::Initialize
When console.log is called for the first time it initializes
TTYWrap object. However, if there is not enough space on the
V8 stack, creating function template fails and triggers
empty maybe local exception.

PR-URL: https://github.com/nodejs/node/pull/26832
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-04-04 15:35:02 +02:00

21 lines
361 B
JavaScript

'use strict';
const common = require('../common');
// This test ensures that console.log
// will not crash the process if there
// is not enough space on the V8 stack
const done = common.mustCall(() => {});
async function test() {
await test();
}
(async () => {
try {
await test();
} catch (err) {
console.log(err);
}
})().then(done, done);