mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
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.
This commit is contained in:
parent
e03bc5d7b0
commit
22d6e099c1
3 changed files with 29 additions and 6 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue