1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-22043 Special character leads to assertion in my_wc_to_printable_generic on 10.5.2 (debug)

The code did not take into account that:
- U+005C (backslash) can occupy more than mbminlen characters (e.g. in sjis)
- Some character sets do not have a code for U+005C (e.g. swe7)

Adding a new function my_wc_to_printable into MY_CHARSET_HANDLER to
cover all special cases easier.
This commit is contained in:
Alexander Barkov
2020-05-07 19:20:17 +04:00
parent c675886dcd
commit cfe5ee90c8
25 changed files with 242 additions and 18 deletions

View File

@@ -541,6 +541,7 @@ struct my_charset_handler_st
my_ci_native_to_mb() rather than my_ci_wc_mb().
*/
my_charset_conv_wc_mb native_to_mb;
my_charset_conv_wc_mb wc_to_printable;
};
extern MY_CHARSET_HANDLER my_charset_8bit_handler;
@@ -660,6 +661,11 @@ struct charset_info_st
return (cset->native_to_mb)(this, wc, s, e);
}
int wc_to_printable(my_wc_t wc, uchar *s, uchar *e) const
{
return (cset->wc_to_printable)(this, wc, s, e);
}
int ctype(int *to, const uchar *s, const uchar *e) const
{
return (cset->ctype)(this, to, s, e);
@@ -1249,9 +1255,6 @@ int my_wc_mb_bin(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
int my_mb_ctype_8bit(CHARSET_INFO *,int *, const uchar *,const uchar *);
int my_mb_ctype_mb(CHARSET_INFO *,int *, const uchar *,const uchar *);
int my_wc_to_printable_generic(CHARSET_INFO *cs, my_wc_t wc,
uchar *s, uchar *e);
size_t my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq);
size_t my_snprintf_8bit(CHARSET_INFO *, char *to, size_t n,