summaryrefslogtreecommitdiff
path: root/storage/myisam/mi_key.c
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mysql.com>2010-08-26 16:36:33 +0400
committerAlexander Barkov <bar@mysql.com>2010-08-26 16:36:33 +0400
commit22d6e099c100a770785e0ffc007741254ad9a515 (patch)
tree22a95174748db7656dc7b0c291d4af92e8b20109 /storage/myisam/mi_key.c
parente03bc5d7b0961bcafa71823476b7cf8df660bcae (diff)
downloadmariadb-git-22d6e099c100a770785e0ffc007741254ad9a515.tar.gz
Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' fai
Problem: trailing spaces were stripped using 8-bit code, so the truncation result length was incorrect, which led to an assertion failure. Fix: using multi-byte safe code.
Diffstat (limited to 'storage/myisam/mi_key.c')
-rw-r--r--storage/myisam/mi_key.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c
index bce42b64e99..75038fce070 100644
--- a/storage/myisam/mi_key.c
+++ b/storage/myisam/mi_key.c
@@ -253,18 +253,17 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
pos=old;
if (keyseg->flag & HA_SPACE_PACK)
{
- uchar *end=pos+length;
if (type == HA_KEYTYPE_NUM)
{
- while (pos < end && pos[0] == ' ')
- pos++;
+ uchar *end= pos + length;
+ while (pos < end && pos[0] == ' ')
+ pos++;
+ length= (uint) (end - pos);
}
else if (type != HA_KEYTYPE_BINARY)
{
- while (end > pos && end[-1] == ' ')
- end--;
+ length= cs->cset->lengthsp(cs, (char*) pos, length);
}
- length=(uint) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
memcpy((uchar*) key,pos,(size_t) char_length);