mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
16aee380a5
When isInsideNodeModules gets called while already processing another stack trace, V8 will not call prepareStackTrace again. This used to cause Node.js to just crash — fix it by checking for expected return type of the stack (Array). PR-URL: https://github.com/nodejs/node/pull/20266 Fixes: https://github.com/nodejs/node/issues/20258 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
18 lines
585 B
JavaScript
18 lines
585 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const bufferWarning = 'Buffer() is deprecated due to security and usability ' +
|
|
'issues. Please use the Buffer.alloc(), ' +
|
|
'Buffer.allocUnsafe(), or Buffer.from() methods instead.';
|
|
|
|
common.expectWarning('DeprecationWarning', bufferWarning, 'DEP0005');
|
|
|
|
// This is used to make sure that a warning is only emitted once even though
|
|
// `new Buffer()` is called twice.
|
|
process.on('warning', common.mustCall());
|
|
|
|
Error.prepareStackTrace = (err, trace) => new Buffer(10);
|
|
|
|
new Error().stack;
|