diff options
author | Alexander Barkov <bar@mariadb.org> | 2015-07-06 10:47:39 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2015-07-06 10:47:39 +0400 |
commit | 35d8ac350d97557d06edd1cffe7ecc28fc68930a (patch) | |
tree | 512910172c0cd233303796e1dfb51cad3180e4ae /strings/strcoll.ic | |
parent | 7ab7f5327a11c9d167fe4300b3d4abe38b704f48 (diff) | |
download | mariadb-git-35d8ac350d97557d06edd1cffe7ecc28fc68930a.tar.gz |
MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
Diffstat (limited to 'strings/strcoll.ic')
-rw-r--r-- | strings/strcoll.ic | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/strings/strcoll.ic b/strings/strcoll.ic index 31f610c4397..5f4ee615d84 100644 --- a/strings/strcoll.ic +++ b/strings/strcoll.ic @@ -118,6 +118,18 @@ MY_FUNCTION_NAME(scan_weight)(int *weight, const uchar *str, const uchar *end) } #endif +#ifdef IS_MB4_CHAR + if (str + 4 > end) /* Incomplete four-byte character */ + goto bad; + + if (IS_MB4_CHAR(str[0], str[1], str[2], str[3])) + { + *weight= WEIGHT_MB4(str[0], str[1], str[2], str[3]); + return 4; /* A valid four-byte character */ + } + +#endif + bad: *weight= WEIGHT_ILSEQ(str[0]); /* Bad byte */ return 1; @@ -252,4 +264,5 @@ MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)), #undef WEIGHT_MB1 #undef WEIGHT_MB2 #undef WEIGHT_MB3 +#undef WEIGHT_MB4 #undef WEIGHT_PAD_SPACE |