Multibyte charsets do not check that incoming data is well-formed
This commit is contained in:
bar@bar.intranet.mysql.r18.ru 2004-02-10 15:42:46 +04:00
commit 5219fc269b
6 changed files with 120 additions and 25 deletions

View file

@ -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;
}