diff options
author | unknown <bar@bar.intranet.mysql.r18.ru> | 2004-02-10 15:42:46 +0400 |
---|---|---|
committer | unknown <bar@bar.intranet.mysql.r18.ru> | 2004-02-10 15:42:46 +0400 |
commit | 102a9c6f50416b3faf79abd3ea360dd3b49b7513 (patch) | |
tree | 1c55fe3d1d94455f6e139c9434c12d2a2388fd8b /strings | |
parent | 2282ec0f81360b477c2dec81e25a4bdafd0bce69 (diff) | |
download | mariadb-git-102a9c6f50416b3faf79abd3ea360dd3b49b7513.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.c | 17 |
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; } |