1
0
Fork 0

Fix: SkipGarbage() skipped all multi-byte utf-8 characters.

`char` is signed so `str[0] < '0'` applies to all characters higher than 127.
pull/13032/head
Peter Nelson 2024-10-26 19:04:06 +01:00
parent 1191efa581
commit 6ed51b3fbd
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
1 changed files with 1 additions and 1 deletions

View File

@ -551,7 +551,7 @@ char *strcasestr(const char *haystack, const char *needle)
*/
static std::string_view SkipGarbage(std::string_view str)
{
while (!str.empty() && (str[0] < '0' || IsInsideMM(str[0], ';', '@' + 1) || IsInsideMM(str[0], '[', '`' + 1) || IsInsideMM(str[0], '{', '~' + 1))) str.remove_prefix(1);
while (!str.empty() && (static_cast<uint8_t>(str[0]) < '0' || IsInsideMM(str[0], ';', '@' + 1) || IsInsideMM(str[0], '[', '`' + 1) || IsInsideMM(str[0], '{', '~' + 1))) str.remove_prefix(1);
return str;
}