Skip to content

Commit d07bacd

Browse files
committed
Add UTF-8 char >= 0x10000 check
1 parent 9bc15d4 commit d07bacd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/backend/utils/mb/wchar.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* conversion functions between pg_wchar and multi-byte streams.
33
* Tatsuo Ishii
4-
* $Id: wchar.c,v 1.23 2001/10/11 14:20:35 ishii Exp $
4+
* $Id: wchar.c,v 1.24 2001/10/15 01:19:15 ishii Exp $
55
*
66
* WIN1250 client encoding updated by Pavel Behal
77
*
@@ -537,11 +537,19 @@ pg_verifymbstr(const unsigned char *mbstr, int len)
537537
int slen = 0;
538538

539539
/* we do not check single byte encodings */
540-
if (pg_encoding_max_length(GetDatabaseEncoding()) <= 1)
540+
if (pg_database_encoding_max_length() <= 1)
541541
return NULL;
542542

543543
while (len > 0 && *mbstr)
544544
{
545+
/* special UTF-8 check */
546+
if (GetDatabaseEncoding() == PG_UTF8 &&
547+
(*mbstr & 0xf8) == 0xf0)
548+
{
549+
snprintf(buf, sizeof(buf), "Unicode >= 0x10000 is not supoorted");
550+
return(buf);
551+
}
552+
545553
l = pg_mblen(mbstr);
546554

547555
/* multi-byte letter? */

0 commit comments

Comments
 (0)