summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorramil/ram@mysql.com/ramil.myoffice.izhnet.ru <>2007-10-04 10:20:00 +0500
committerramil/ram@mysql.com/ramil.myoffice.izhnet.ru <>2007-10-04 10:20:00 +0500
commitbc9b4834e1f95f02008e41b8e5ce62968befd53a (patch)
treee47d7238dc0f1a553b33aec326c1494de7a91bf6 /strings
parente78513165c1b4e1696167e9fac6558e4492bc815 (diff)
downloadmariadb-git-bc9b4834e1f95f02008e41b8e5ce62968befd53a.tar.gz
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.
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-big5.c4
-rw-r--r--strings/ctype-cp932.c4
-rw-r--r--strings/ctype-euc_kr.c4
-rw-r--r--strings/ctype-gb2312.c4
-rw-r--r--strings/ctype-sjis.c4
5 files changed, 9 insertions, 11 deletions
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 89a40b15288..90917229769 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -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;
diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c
index e8c62b0315e..3752b2e4118 100644
--- a/strings/ctype-cp932.c
+++ b/strings/ctype-cp932.c
@@ -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;
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index 25ac416ac60..50300f3c140 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -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;
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index 556f485945b..e81f9d3cf0c 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -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;
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 38a9c9a6428..92d6b4dc2ae 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -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;