mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 17:01:08 +00:00

Fixes multiple possible segmentation faults in node_contextify.cc and an assertion failure in node_os.cc Fixes: https://github.com/nodejs/node/issues/12369 Fixes: https://github.com/nodejs/node/issues/12370 PR-URL: https://github.com/nodejs/node/pull/12371 Reviewed-By: Anna Henningsen <anna@addaleax.net>
38 lines
886 B
JavaScript
38 lines
886 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const execFile = require('child_process').execFile;
|
|
|
|
const scripts = [
|
|
`os.userInfo({
|
|
get encoding() {
|
|
throw new Error('xyz');
|
|
}
|
|
})`
|
|
];
|
|
|
|
['filename', 'cachedData', 'produceCachedData', 'lineOffset', 'columnOffset']
|
|
.forEach((prop) => {
|
|
scripts.push(`vm.createScript('', {
|
|
get ${prop} () {
|
|
throw new Error('xyz');
|
|
}
|
|
})`);
|
|
});
|
|
|
|
['breakOnSigint', 'timeout', 'displayErrors']
|
|
.forEach((prop) => {
|
|
scripts.push(`vm.createScript('').runInThisContext({
|
|
get ${prop} () {
|
|
throw new Error('xyz');
|
|
}
|
|
})`);
|
|
});
|
|
|
|
scripts.forEach((script) => {
|
|
const node = process.execPath;
|
|
execFile(node, [ '-e', script ], common.mustCall((err, stdout, stderr) => {
|
|
assert(stderr.includes('Error: xyz'), 'createScript crashes');
|
|
}));
|
|
});
|