We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6d89df0 commit 7d61d2fCopy full SHA for 7d61d2f
fallback/encoding.util.js
@@ -23,7 +23,7 @@ export function unfinishedBytes(u, len, enc) {
23
let p = 0
24
if (len % 2 !== 0) p++ // uneven bytes
25
const l = len - p - 1
26
- if (len - p >= 2) {
+ if (l >= 1) {
27
const last = enc === 'utf-16le' ? (u[l] << 8) ^ u[l - 1] : (u[l - 1] << 8) ^ u[l]
28
if (last >= 0xd8_00 && last < 0xdc_00) p += 2 // lone lead
29
}
0 commit comments