mirror of
https://github.com/MariaDB/server.git
synced 2026-05-10 09:04:29 +02:00
Multibyte charsets do not check that incoming data is well-formed
This commit is contained in:
parent
bccca8f7cb
commit
5219fc269b
6 changed files with 120 additions and 25 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue