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

Maximum call size exceeded #2

Open
karlr42 opened this issue Oct 2, 2014 · 0 comments
Open

Maximum call size exceeded #2

karlr42 opened this issue Oct 2, 2014 · 0 comments

Comments

@karlr42
Copy link

karlr42 commented Oct 2, 2014

I found when I was decompressing a large piece of data in Chrome stable, I would get a 'RangeError: Maximum call size exceeded'. I tracked this down, the problem is in JSONC.unpack, which calls String.fromCharCode.apply() on the decoded data. When the data is very long, you reach the argument limit of the VM. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply

But beware: in using apply this way, you run the risk of exceeding the JavaScript engine's argument length limit. The consequences of applying a function with too many arguments (think more than tens of thousands of arguments) vary across engines...

I patched this locally by wrapping the call in a try/catch, and if the RangeError happens, I loop through the data and call fromCharCode() on each iteration, instead of calling apply- same effect. I will submit a pull request.

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

No branches or pull requests

1 participant