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

@@ -5466,6 +5466,7 @@ MY_CHARSET_HANDLER my_charset_utf8mb3_handler=
my_well_formed_char_length_utf8mb3,
my_copy_fix_mb,
my_uni_utf8mb3,
my_wc_to_printable_generic
};
@@ -7030,6 +7031,16 @@ my_charlen_filename(CHARSET_INFO *cs, const uchar *str, const uchar *end)
}
static int
my_wc_to_printable_filename(CHARSET_INFO *cs, my_wc_t wc,
uchar *str, uchar *end)
{
return my_wc_to_printable_ex(cs, wc, str, end,
'\\', 5, 1);
}
#define MY_FUNCTION_NAME(x) my_ ## x ## _filename
#define CHARLEN(cs,str,end) my_charlen_filename(cs,str,end)
#define DEFINE_WELL_FORMED_CHAR_LENGTH_USING_CHARLEN
@@ -7102,6 +7113,7 @@ static MY_CHARSET_HANDLER my_charset_filename_handler=
my_well_formed_char_length_filename,
my_copy_fix_mb,
my_wc_mb_filename,
my_wc_to_printable_filename
};
@@ -7792,6 +7804,7 @@ MY_CHARSET_HANDLER my_charset_utf8mb4_handler=
my_well_formed_char_length_utf8mb4,
my_copy_fix_mb,
my_wc_mb_utf8mb4,
my_wc_to_printable_generic
};