Skip to content

Commit

Permalink
deps: cherry-pick libuv/libuv@d09441c
Browse files Browse the repository at this point in the history
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: libuv/libuv#2970
    Fixes: #48673

PR-URL: #51976
Refs: #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>
  • Loading branch information
richardlau committed Mar 15, 2024
1 parent ea50540 commit cb49f31
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deps/uv/src/win/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cb49f31

Please sign in to comment.