summaryrefslogtreecommitdiff
path: root/strings/ctype-ujis.c
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2014-09-24 17:27:00 +0400
committerAlexander Barkov <bar@mariadb.org>2014-09-24 17:27:00 +0400
commit3416facb3461b2994713e0dd0146579093a27282 (patch)
tree0be5308f0d466c43cf9801cd5c33cfe464139b08 /strings/ctype-ujis.c
parent9fa62b47f032bf824738e4150fc29d8e629a7eda (diff)
downloadmariadb-git-3416facb3461b2994713e0dd0146579093a27282.tar.gz
MDEV-6776 ujis and eucjmps erroneously accept 0x8EA0 as a valid byte sequence
Diffstat (limited to 'strings/ctype-ujis.c')
-rw-r--r--strings/ctype-ujis.c17
1 files changed, 8 insertions, 9 deletions
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 */