diff --git a/lib/utils/strings.js b/lib/utils/strings.js index 313c27b..b07a732 100644 --- a/lib/utils/strings.js +++ b/lib/utils/strings.js @@ -83,8 +83,10 @@ exports.string2buf = function (str) { // Helper (used in 2 places) function buf2binstring(buf, len) { - // use fallback for big arrays to avoid stack overflow - if (len < 65537) { + // On Chrome, the arguments in a function call that are allowed is `65534`. + // If the length of the buffer is smaller than that, we can use this optimization, + // otherwise we will take a slower path. + if (len < 65534) { if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); }