A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nodejs/node/commit/4d9d6830e0 below:

force slow JSON.stringify path for overflow · nodejs/node@4d9d683 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+8

-4

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+8

-4

lines changed Original file line number Diff line number Diff line change

@@ -26,11 +26,15 @@ Error.stackTraceLimit = 0;

26 26 27 27

console.error('before');

28 28 29 +

// Invalidate elements protector to force slow-path.

30 +

// The fast-path of JSON.stringify is iterative and won't throw.

31 +

Array.prototype[2] = 'foo';

32 + 29 33

// Trigger stack overflow by stringifying a deeply nested array.

30 -

let array = [];

31 -

for (let i = 0; i < 100000; i++) {

32 -

array = [ array ];

33 -

}

34 +

// eslint-disable-next-line no-sparse-arrays

35 +

let array = [,];

36 +

for (let i = 0; i < 10000; i++)

37 +

array = [array];

34 38 35 39

JSON.stringify(array);

36 40

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4