Skip to content

Commit

Permalink
UTF-8 validation: fix one cotec check corner issue
Browse files Browse the repository at this point in the history
fix github issue #362
  • Loading branch information
hongyang7 committed Feb 15, 2023
1 parent 44b5955 commit c1539d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/parser/utf8_validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ bool isValidUtf8(const char *expression, const size_t len) {
while (i < len) {
DEBUG_PRINTF("byte %zu: 0x%02x\n", i, s[i]);
// One octet.
if (s[i] < 0x7f) {
if (s[i] <= 0x7f) {
DEBUG_PRINTF("one octet\n");
i++;
continue;
Expand Down
4 changes: 2 additions & 2 deletions unit/internal/utf8_validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ static ValidUtf8TestInfo valid_utf8_tests[] = {
{"공동경비구역", true},
{"জলসাঘর", true},

// Invalid one-byte caseS.
{"\x7f", false},
// Valid one-byte caseS.
{"\x7f", true}, // \x7f is valid

// These bytes should never appear in a UTF-8 stream.
{"\xc0", false},
Expand Down

0 comments on commit c1539d3

Please sign in to comment.