mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
c5c9515c1b
Previously, fs.readdirSync calls the function returned by env->push_values_to_array_function() in batch and check the returned Maybe right away in C++, which can lead to assertions if the call stack already reaches the maximum size. This patch fixes that by returning early the call fails so the stack overflow error will be properly thrown into JS land. PR-URL: https://github.com/nodejs/node/pull/18647 Fixes: https://github.com/nodejs/node/issues/18645 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
19 lines
261 B
JavaScript
19 lines
261 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const fs = require('fs');
|
|
|
|
function recurse() {
|
|
fs.readdirSync('.');
|
|
recurse();
|
|
}
|
|
|
|
common.expectsError(
|
|
() => recurse(),
|
|
{
|
|
type: RangeError,
|
|
message: 'Maximum call stack size exceeded'
|
|
}
|
|
);
|