Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix max call stack issue #99

Merged
merged 2 commits into from
Oct 19, 2020
Merged

Fix max call stack issue #99

merged 2 commits into from
Oct 19, 2020

Conversation

JLRishe
Copy link
Collaborator

@JLRishe JLRishe commented Oct 19, 2020

Pull request #98 with some modifications.

noseworthy and others added 2 commits October 18, 2020 01:52
When calling the flatten function with a sufficiently large array it
will throw: RangeError: Maximum call stack size exceeded

This was found when processing very large xml documents and using a //
selector in select().

This is due to the maximum argument length limit in javascript/node.
Calling apply() with a sufficiently large array will throw a RangeError.
See https://bugs.webkit.org/show_bug.cgi?id=80797 for details.

Chunk the array into chunks that are smaller than the maximum argument
list size using `slice()` and call `concat.apply()` on each chunk so
that we never get the range error.
@JLRishe JLRishe merged commit b62c281 into master Oct 19, 2020
@JLRishe JLRishe deleted the fix_max_call_stack_issue branch July 18, 2023 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants