mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
deps: cherry-pick libuv/libuv@d09441c
Original commit message:
fs: fix WTF-8 decoding issue (#4092)
We forgot to mask off the high bits from the first byte, so we ended up
always failing the subsequent range check.
Refs: https://github.com/libuv/libuv/pull/2970
Fixes: https://github.com/nodejs/node/issues/48673
PR-URL: https://github.com/nodejs/node/pull/51976
Refs: https://github.com/nodejs/node/issues/48673
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
This commit is contained in:
1 file changed
+3
-1
Vendored
+3
-1
@@ -176,9 +176,11 @@ static int32_t fs__decode_wtf8_char(const char** input) {
|
||||
if ((b4 & 0xC0) != 0x80)
|
||||
return -1; /* invalid: not a continuation byte */
|
||||
code_point = (code_point << 6) | (b4 & 0x3F);
|
||||
if (b1 <= 0xF4)
|
||||
if (b1 <= 0xF4) {
|
||||
code_point &= 0x1FFFFF;
|
||||
if (code_point <= 0x10FFFF)
|
||||
return code_point; /* four-byte character */
|
||||
}
|
||||
|
||||
/* code point too large */
|
||||
return -1;
|
||||
|
||||
Reference in new issue
Block a user