summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@host.loc>2008-04-23 11:06:26 +0500
committerunknown <gshchepa/uchum@host.loc>2008-04-23 11:06:26 +0500
commit68dc7a1376cdd481e3879b7c86c4adeb32787014 (patch)
treea2ecc8aded425fd30407dc717fe1b6a7e4ffa81b /strings
parent14177de7508c0cbeb2f82aa8c6032c9c0ccbb6e9 (diff)
parentdee04cb564df421641f5da5401658e9a588743a0 (diff)
downloadmariadb-git-68dc7a1376cdd481e3879b7c86c4adeb32787014.tar.gz
Merge host.loc:/home/uchum/work/5.0-bugteam
into host.loc:/home/uchum/work/5.1-bugteam mysql-test/r/ctype_gbk.result: Auto merged mysql-test/r/subselect3.result: Auto merged mysql-test/t/subselect3.test: Auto merged sql/sql_select.cc: Auto merged strings/ctype-big5.c: Merge with 5.0-bugteam (bug#35993). strings/ctype-gbk.c: Merge with 5.0-bugteam (bug#35993).
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-big5.c6
-rw-r--r--strings/ctype-gbk.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index ecfd3d648e0..3da307b82fc 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -307,15 +307,17 @@ static size_t my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
{
uint16 e;
size_t dstlen= len;
+ uchar *dest_end= dest + dstlen;
len = srclen;
- while (len--)
+ while (len-- && dest < dest_end)
{
if ((len > 0) && isbig5code(*src, *(src+1)))
{
e = big5strokexfrm((uint16) big5code(*src, *(src+1)));
*dest++ = big5head(e);
- *dest++ = big5tail(e);
+ if (dest < dest_end)
+ *dest++ = big5tail(e);
src +=2;
len--;
} else
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index c7a2558eb37..7b8bb85652b 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -2668,15 +2668,17 @@ static size_t my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
{
uint16 e;
size_t dstlen= len;
+ uchar *dest_end= dest + dstlen;
len = srclen;
- while (len--)
+ while (len-- && dest < dest_end)
{
if ((len > 0) && isgbkcode(*src, *(src+1)))
{
e = gbksortorder((uint16) gbkcode(*src, *(src+1)));
*dest++ = gbkhead(e);
- *dest++ = gbktail(e);
+ if (dest < dest_end)
+ *dest++ = gbktail(e);
src+=2;
len--;
} else