diff options
author | Alexander Barkov <bar@mariadb.org> | 2014-09-24 17:27:00 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2014-09-24 17:27:00 +0400 |
commit | 3416facb3461b2994713e0dd0146579093a27282 (patch) | |
tree | 0be5308f0d466c43cf9801cd5c33cfe464139b08 /strings | |
parent | 9fa62b47f032bf824738e4150fc29d8e629a7eda (diff) | |
download | mariadb-git-3416facb3461b2994713e0dd0146579093a27282.tar.gz |
MDEV-6776 ujis and eucjmps erroneously accept 0x8EA0 as a valid byte sequence
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-eucjpms.c | 17 | ||||
-rw-r--r-- | strings/ctype-ujis.c | 17 |
2 files changed, 16 insertions, 18 deletions
diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index 20972fbe136..0ce179b3a2d 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -67418,10 +67418,10 @@ my_wc_mb_eucjpms(CHARSET_INFO *cs __attribute__((unused)), /* EUCJPMS encoding subcomponents: - [x00-x7F] # ASCII/JIS-Roman (one-byte/character) - [x8E][xA0-xDF] # half-width katakana (two bytes/char) - [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990 (three bytes/char) - [xA1-xFE][xA1-xFE] # JIS X 0208:1997 (two bytes/char) + [x00-x7F] # ASCII/JIS-Roman (one-byte/character) + [x8E][xA1-xDF] # half-width katakana (two bytes/char) + [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990 (three bytes/char) + [xA1-xFE][xA1-xFE] # JIS X 0208:1997 (two bytes/char) */ static @@ -67444,15 +67444,15 @@ size_t my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), if (b >= (uchar *) end) /* need more bytes */ return (uint) (chbeg - beg); /* unexpected EOL */ - if (ch == 0x8E) /* [x8E][xA0-xDF] */ + if (iseucjpms_ss2(ch)) /* [x8E][xA1-xDF] */ { - if (*b >= 0xA0 && *b <= 0xDF) + if (iskata(*b)) continue; *error=1; return (uint) (chbeg - beg); /* invalid sequence */ } - if (ch == 0x8F) /* [x8F][xA1-xFE][xA1-xFE] */ + if (iseucjpms_ss3(ch)) /* [x8F][xA1-xFE][xA1-xFE] */ { ch= *b++; if (b >= (uchar*) end) @@ -67462,8 +67462,7 @@ size_t my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), } } - if (ch >= 0xA1 && ch <= 0xFE && - *b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */ + if (iseucjpms(ch) && iseucjpms(*b)) /* [xA1-xFE][xA1-xFE] */ continue; *error=1; return (size_t) (chbeg - beg); /* invalid sequence */ diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index a6d9fb96fb1..e7dbefe6c1d 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -203,10 +203,10 @@ static uint mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c) /* EUC-JP encoding subcomponents: - [x00-x7F] # ASCII/JIS-Roman (one-byte/character) - [x8E][xA0-xDF] # half-width katakana (two bytes/char) - [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990 (three bytes/char) - [xA1-xFE][xA1-xFE] # JIS X 0208:1997 (two bytes/char) + [x00-x7F] # ASCII/JIS-Roman (one-byte/character) + [x8E][xA1-xDF] # half-width katakana (two bytes/char) + [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990 (three bytes/char) + [xA1-xFE][xA1-xFE] # JIS X 0208:1997 (two bytes/char) */ static @@ -231,15 +231,15 @@ size_t my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), return (size_t) (chbeg - beg); /* unexpected EOL */ } - if (ch == 0x8E) /* [x8E][xA0-xDF] */ + if (isujis_ss2(ch)) /* [x8E][xA1-xDF] */ { - if (*b >= 0xA0 && *b <= 0xDF) + if (iskata(*b)) continue; *error= 1; return (size_t) (chbeg - beg); /* invalid sequence */ } - if (ch == 0x8F) /* [x8F][xA1-xFE][xA1-xFE] */ + if (isujis_ss3(ch)) /* [x8F][xA1-xFE][xA1-xFE] */ { ch= *b++; if (b >= (uchar*) end) @@ -249,8 +249,7 @@ size_t my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), } } - if (ch >= 0xA1 && ch <= 0xFE && - *b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */ + if (isujis(ch) && isujis(*b)) /* [xA1-xFE][xA1-xFE] */ continue; *error= 1; return (size_t) (chbeg - beg); /* invalid sequence */ |