mishoo / UglifyJS

JavaScript parser / mangler / compressor / beautifier toolkit
http://lisperator.net/uglifyjs/
Other
13.14k stars 1.25k forks source link

Compressed code throws "Maximum call stack size exceeded" on Chrome #1038

Closed yurydelendik closed 8 years ago

yurydelendik commented 8 years ago

While it's V8's issue (see https://bugs.chromium.org/p/chromium/issues/detail?id=602262), it's recommended to split really long sequence operators expression (,) so Chrome could consume the output.

Originally reported at https://github.com/mozilla/pdf.js/issues/7044 . Workaround is to use sequences: false option for compressor.

mishoo commented 8 years ago

We already have something like this in place. That allows at most 2000 statements to be joined in a sequence. Should we lower the number? Is there some safe limit?

yurydelendik commented 8 years ago

Here is output https://gist.github.com/yurydelendik/6b4e578fe080802bac7d554fde3d57f9 of https://github.com/mozilla/pdf.js/blob/master/src/core/glyphlist.js#L29 . There are more than 4000 commas (,) and no ';' in the function body.

kzc commented 8 years ago

Duplicate of bug: https://github.com/mishoo/UglifyJS2/issues/823 Chrome x64 crashes when "sequences" switch ON

The uglify sequence generation limit could conceivably be user settable via sequences=n where n the maximum number of elements in a sequence. This could remain compatible with true and false.

But the thing is this is actually a serious Chrome/V8 bug that could potentially lead to an exploit. I'm at a loss why Google is not addressing this problem in their browser.