We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 052feb9 commit 2b99d3aCopy full SHA for 2b99d3a
1 file changed
fallback/utf8.js
@@ -10,7 +10,8 @@ export function decode(arr, loose, start = 0) {
10
const end = arr.length
11
let out = ''
12
const chunkSize = 0x2_00 // far below MAX_ARGUMENTS_LENGTH in npmjs.com/buffer, we use smaller chunks
13
- const tmp = new Array(chunkSize + 1).fill(0) // need 1 extra slot for last codepoint, which can be 2 charcodes
+ const tmpSize = Math.min(end - start, chunkSize + 1) // need 1 extra slot for last codepoint, which can be 2 charcodes
14
+ const tmp = new Array(tmpSize).fill(0)
15
let ti = 0
16
17
for (let i = start; i < end; i++) {
0 commit comments