Skip to content

Commit ec68494

Browse files
author
Alexander Barkov
committed
MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member
1 parent 4fbba09 commit ec68494

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

mysql-test/r/ctype_filename.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@ create table com1 (a int);
1111
drop table com1;
1212
create table `clock$` (a int);
1313
drop table `clock$`;
14+
#
15+
# MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member
16+
#
17+
SET NAMES utf8;
18+
SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a), HEX(REVERSE(@a));
19+
@a BINARY @a REVERSE(@a) HEX(@a) HEX(REVERSE(@a))
20+
aя a@r1 яa 61407231 40723161

mysql-test/t/ctype_filename.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ drop table com1;
1919

2020
create table `clock$` (a int);
2121
drop table `clock$`;
22+
23+
--echo #
24+
--echo # MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member
25+
--echo #
26+
SET NAMES utf8;
27+
SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a), HEX(REVERSE(@a));

strings/ctype-utf8.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7098,7 +7098,7 @@ my_wc_mb_filename(CHARSET_INFO *cs __attribute__((unused)),
70987098
my_wc_t wc, uchar *s, uchar *e)
70997099
{
71007100
int code;
7101-
char hex[]= "0123456789abcdef";
7101+
static const char hex[]= "0123456789abcdef";
71027102

71037103
if (s >= e)
71047104
return MY_CS_TOOSMALL;
@@ -7144,6 +7144,15 @@ my_charlen_filename(CHARSET_INFO *cs, const uchar *str, const uchar *end)
71447144
}
71457145

71467146

7147+
static uint
7148+
my_ismbchar_filename(CHARSET_INFO *cs, const char *str, const char *end)
7149+
{
7150+
my_wc_t wc;
7151+
int rc= my_mb_wc_filename(cs, &wc, (const uchar *) str, (const uchar *) end);
7152+
return rc > 1 ? rc : 0;
7153+
}
7154+
7155+
71477156
#define MY_FUNCTION_NAME(x) my_ ## x ## _filename
71487157
#define CHARLEN(cs,str,end) my_charlen_filename(cs,str,end)
71497158
#define DEFINE_WELL_FORMED_CHAR_LENGTH_USING_CHARLEN
@@ -7172,7 +7181,7 @@ static MY_COLLATION_HANDLER my_collation_filename_handler =
71727181
static MY_CHARSET_HANDLER my_charset_filename_handler=
71737182
{
71747183
NULL, /* init */
7175-
my_ismbchar_utf8,
7184+
my_ismbchar_filename,
71767185
my_mbcharlen_utf8,
71777186
my_numchars_mb,
71787187
my_charpos_mb,

0 commit comments

Comments
 (0)