From 3ff5679947ebde4938998bc5742c8a5d8343de67 Mon Sep 17 00:00:00 2001 From: John Naylor Date: Sun, 18 Jul 2021 19:28:57 -0400 Subject: [PATCH v18 5/6] Do 1-byte ascii check if 8-byte check fails --- src/common/wchar.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/wchar.c b/src/common/wchar.c index bba54912f9..465efd2e0d 100644 --- a/src/common/wchar.c +++ b/src/common/wchar.c @@ -1992,6 +1992,14 @@ pg_utf8_verifystr(const unsigned char *s, int len) continue; } + /* check if the first byte is both non-zero and doesn't have the high bit set */ + if ((signed char) (*s) > 0) + { + s++; + len--; + continue; + } + /* * Found non-ASCII or zero above, so verify a single character. */ -- 2.31.1