summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2021-11-02 09:00:49 +0400
committerAlexander Barkov <bar@mariadb.com>2021-11-02 09:00:49 +0400
commitd0b611a76d91a5b6dbbc8fab792d7daaaaa862f5 (patch)
treee0102ee1fafc12825998f13da009c2c960a89d40 /strings
parent026984c360ce27c62072ed6ce798ec855952c974 (diff)
downloadmariadb-git-d0b611a76d91a5b6dbbc8fab792d7daaaaa862f5.tar.gz
MDEV-24335 Unexpected question mark in the end of a TINYTEXT column
my_copy_fix_mb() passed MIN(src_length,dst_length) to my_append_fix_badly_formed_tail(). It could break a multi-byte character in the middle, which put the question mark to the destination. Fixing the code to pass the true src_length to my_append_fix_badly_formed_tail().
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-mb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index cabc940065b..caeb9f95ef1 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -401,10 +401,10 @@ my_copy_fix_mb(CHARSET_INFO *cs,
size_t well_formed_nchars;
size_t well_formed_length;
size_t fixed_length;
+ size_t min_length= MY_MIN(src_length, dst_length);
- set_if_smaller(src_length, dst_length);
well_formed_nchars= cs->cset->well_formed_char_length(cs,
- src, src + src_length,
+ src, src + min_length,
nchars, status);
DBUG_ASSERT(well_formed_nchars <= nchars);
well_formed_length= status->m_source_end_pos - src;