mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
UTF-8 validation: fix one cotec check corner issue
fix github issue #362
This commit is contained in:
parent
7c1835c0e7
commit
684f0ce2cb
@ -72,7 +72,7 @@ bool isValidUtf8(const char *expression, const size_t len) {
|
|||||||
while (i < len) {
|
while (i < len) {
|
||||||
DEBUG_PRINTF("byte %zu: 0x%02x\n", i, s[i]);
|
DEBUG_PRINTF("byte %zu: 0x%02x\n", i, s[i]);
|
||||||
// One octet.
|
// One octet.
|
||||||
if (s[i] < 0x7f) {
|
if (s[i] <= 0x7f) {
|
||||||
DEBUG_PRINTF("one octet\n");
|
DEBUG_PRINTF("one octet\n");
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -64,8 +64,8 @@ static ValidUtf8TestInfo valid_utf8_tests[] = {
|
|||||||
{"공동경비구역", true},
|
{"공동경비구역", true},
|
||||||
{"জলসাঘর", true},
|
{"জলসাঘর", true},
|
||||||
|
|
||||||
// Invalid one-byte caseS.
|
// Valid one-byte caseS.
|
||||||
{"\x7f", false},
|
{"\x7f", true}, // \x7f is valid
|
||||||
|
|
||||||
// These bytes should never appear in a UTF-8 stream.
|
// These bytes should never appear in a UTF-8 stream.
|
||||||
{"\xc0", false},
|
{"\xc0", false},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user