From 3e078abbafca53d6ac3cc773cd2531dcff6f7be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 15 Jan 2024 10:45:19 +0100 Subject: [PATCH] Restore nul check in u8_nextchar --- Common/Data/Encoding/Utf8.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/Data/Encoding/Utf8.cpp b/Common/Data/Encoding/Utf8.cpp index 6da1e0e054..a6324a78fc 100644 --- a/Common/Data/Encoding/Utf8.cpp +++ b/Common/Data/Encoding/Utf8.cpp @@ -214,7 +214,7 @@ uint32_t u8_nextchar(const char *s, int *index, size_t size) { do { ch = (ch << 6) + (unsigned char)s[i++]; sz++; - } while (i < size && ((s[i]) & 0xC0) == 0x80); + } while (i < size && s[i] && ((s[i]) & 0xC0) == 0x80); *index = i; return ch - offsetsFromUTF8[sz - 1]; }