]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
UTF-8 validation: fix one cotec check corner issue
authorHong, Yang A <yang.a.hong@intel.com>
Thu, 28 Jul 2022 21:24:31 +0000 (21:24 +0000)
committerKonstantinos Margaritis <markos@freevec.org>
Tue, 5 Sep 2023 10:49:41 +0000 (13:49 +0300)
fix github issue #362

src/parser/utf8_validate.cpp
unit/internal/utf8_validate.cpp

index 50aa06d8e7832cdcb5a7da47f17fd76889dc81e4..a4b7479694fb05e72df5e399aa3545587b870cf3 100644 (file)
@@ -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;
index 0335794203355c362893602d733a178e2e651e8e..f69ee857499bf9eba645d79b1be86654c7712387 100644 (file)
@@ -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},