Skip to content

Commit c623d8e

Browse files
committed
deps: cherry-pick libuv/libuv@d09441c
Original commit message: fs: fix WTF-8 decoding issue (nodejs#4092) We forgot to mask off the high bits from the first byte, so we ended up always failing the subsequent range check. Refs: libuv/libuv#2970 Fixes: nodejs#48673
1 parent ea50540 commit c623d8e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

deps/uv/src/win/fs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,11 @@ static int32_t fs__decode_wtf8_char(const char** input) {
176176
if ((b4 & 0xC0) != 0x80)
177177
return -1; /* invalid: not a continuation byte */
178178
code_point = (code_point << 6) | (b4 & 0x3F);
179-
if (b1 <= 0xF4)
179+
if (b1 <= 0xF4) {
180+
code_point &= 0x1FFFFF;
180181
if (code_point <= 0x10FFFF)
181182
return code_point; /* four-byte character */
183+
}
182184

183185
/* code point too large */
184186
return -1;

0 commit comments

Comments
 (0)