mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fix for bug #31069: crash in 'sounds like'
and for bug #31070: crash during conversion of charsets Problem: passing a 0 byte length string to some my_mb_wc_XXX() functions leads to server crash due to improper argument check. Fix: properly check arguments passed to my_mb_wc_XXX() functions. mysql-test/include/ctype_common.inc: Fix for bug #31069: crash in 'sounds like' and bug #31070: crash during conversion of charsets - test case. mysql-test/r/ctype_big5.result: Fix for bug #31069: crash in 'sounds like' and bug #31070: crash during conversion of charsets - test result. mysql-test/r/ctype_euckr.result: Fix for bug #31069: crash in 'sounds like' and bug #31070: crash during conversion of charsets - test result. mysql-test/r/ctype_gb2312.result: Fix for bug #31069: crash in 'sounds like' and bug #31070: crash during conversion of charsets - test result. mysql-test/r/ctype_gbk.result: Fix for bug #31069: crash in 'sounds like' and bug #31070: crash during conversion of charsets - test result. mysql-test/r/ctype_uca.result: Fix for bug #31069: crash in 'sounds like' and bug #31070: crash during conversion of charsets - test result. strings/ctype-big5.c: Fix for bug #31069: crash in 'sounds like' and bug #31070: crash during conversion of charsets - check the string length before testing its first byte. strings/ctype-cp932.c: Fix for bug #31069: crash in 'sounds like' and bug #31070: crash during conversion of charsets - check the string length before testing its first byte. strings/ctype-euc_kr.c: Fix for bug #31069: crash in 'sounds like' and bug #31070: crash during conversion of charsets - check the string length before testing its first byte. strings/ctype-gb2312.c: Fix for bug #31069: crash in 'sounds like' and bug #31070: crash during conversion of charsets - check the string length before testing its first byte. strings/ctype-sjis.c: Fix for bug #31069: crash in 'sounds like' and bug #31070: crash during conversion of charsets - check the string length before testing its first byte.
This commit is contained in:
@ -6256,12 +6256,12 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
|
||||
my_wc_t *pwc,const uchar *s,const uchar *e)
|
||||
{
|
||||
|
||||
int hi=s[0];
|
||||
int hi;
|
||||
|
||||
if (s >= e)
|
||||
return MY_CS_TOOSMALL;
|
||||
|
||||
if (hi<0x80)
|
||||
if ((hi= s[0]) < 0x80)
|
||||
{
|
||||
pwc[0]=hi;
|
||||
return 1;
|
||||
|
@ -5352,12 +5352,12 @@ my_wc_mb_cp932(CHARSET_INFO *cs __attribute__((unused)),
|
||||
static int
|
||||
my_mb_wc_cp932(CHARSET_INFO *cs __attribute__((unused)),
|
||||
my_wc_t *pwc, const uchar *s, const uchar *e){
|
||||
int hi=s[0];
|
||||
int hi;
|
||||
|
||||
if (s >= e)
|
||||
return MY_CS_TOOSMALL;
|
||||
|
||||
if (hi < 0x80)
|
||||
if ((hi= s[0]) < 0x80)
|
||||
{
|
||||
pwc[0]=hi;
|
||||
return 1;
|
||||
|
@ -8614,12 +8614,12 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
|
||||
my_wc_t *pwc, const uchar *s, const uchar *e)
|
||||
{
|
||||
|
||||
int hi=s[0];
|
||||
int hi;
|
||||
|
||||
if (s >= e)
|
||||
return MY_CS_TOOSMALL;
|
||||
|
||||
if (hi<0x80)
|
||||
if ((hi= s[0]) < 0x80)
|
||||
{
|
||||
pwc[0]=hi;
|
||||
return 1;
|
||||
|
@ -5665,12 +5665,10 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
|
||||
my_wc_t *pwc, const uchar *s, const uchar *e){
|
||||
int hi;
|
||||
|
||||
hi=(int) s[0];
|
||||
|
||||
if (s >= e)
|
||||
return MY_CS_TOOSMALL;
|
||||
|
||||
if (hi<0x80)
|
||||
if ((hi= s[0]) < 0x80)
|
||||
{
|
||||
pwc[0]=hi;
|
||||
return 1;
|
||||
|
@ -4512,12 +4512,12 @@ mb:
|
||||
static int
|
||||
my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
||||
my_wc_t *pwc, const uchar *s, const uchar *e){
|
||||
int hi=s[0];
|
||||
int hi;
|
||||
|
||||
if (s >= e)
|
||||
return MY_CS_TOOSMALL;
|
||||
|
||||
if (hi < 0x80)
|
||||
if ((hi= s[0]) < 0x80)
|
||||
{
|
||||
pwc[0]=hi;
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user