summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorbar@bar.intranet.mysql.r18.ru <>2004-02-10 15:42:46 +0400
committerbar@bar.intranet.mysql.r18.ru <>2004-02-10 15:42:46 +0400
commit5219fc269b61f9d1000f736763ad166cb869d8d0 (patch)
tree1c55fe3d1d94455f6e139c9434c12d2a2388fd8b /strings
parentbccca8f7cb5cb8de21e8cc76984c739fc5316ffe (diff)
downloadmariadb-git-5219fc269b61f9d1000f736763ad166cb869d8d0.tar.gz
http://bugs.mysql.com/bug.php?id=2368
Multibyte charsets do not check that incoming data is well-formed
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-mb.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 377bf311d38..46f3e2f4fc3 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -274,18 +274,21 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)),
return pos ? e+2-b0 : b-b0;
}
-uint my_wellformedlen_mb(CHARSET_INFO *cs __attribute__((unused)),
- const char *b, const char *e, uint pos)
+uint my_wellformedlen_mb(CHARSET_INFO *cs,
+ const char *b, const char *e, uint pos)
{
- uint mblen;
- const char *b0=b;
+ my_wc_t wc;
+ int mblen;
+ const char *b0= b;
- while (pos && b<e)
+ while (pos)
{
- b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1;
+ if ((mblen= cs->cset->mb_wc(cs, &wc, b, e)) <0)
+ break;
+ b+= mblen;
pos--;
}
- return b-b0;
+ return b - b0;
}