diff options
author | Alexander Barkov <bar@mariadb.org> | 2014-09-18 12:40:55 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2014-09-18 12:40:55 +0400 |
commit | 8286bcd721a4555a1b49502d83caafc54c1752a6 (patch) | |
tree | 50d2ffae19ff3537631c709a829317b83c08fc29 /sql/sql_string.cc | |
parent | 391fddf6604c733f271b96189caa366049cc6ee4 (diff) | |
download | mariadb-git-8286bcd721a4555a1b49502d83caafc54c1752a6.tar.gz |
MDEV-6752 Trailing incomplete characters are not replaced to question marks on conversion
Diffstat (limited to 'sql/sql_string.cc')
-rw-r--r-- | sql/sql_string.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 55bf0f9b1c7..a7bfa6c1455 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -1022,8 +1022,15 @@ well_formed_copy_nchars(CHARSET_INFO *to_cs, wc= '?'; } else - break; // Not enough characters - + { + if ((uchar *) from >= from_end) + break; // End of line + // Incomplete byte sequence + if (!*well_formed_error_pos) + *well_formed_error_pos= from; + from++; + wc= '?'; + } outp: if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0) to+= cnvres; |