summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bdb/btree/bt_open.c2
-rw-r--r--bdb/hash/hash_open.c2
-rw-r--r--client/mysql.cc7
-rw-r--r--mysql-test/r/ctype_big5.result7
-rw-r--r--mysql-test/t/ctype_big5.test9
-rw-r--r--ndb/src/kernel/vm/VMSignal.cpp4
-rw-r--r--strings/ctype-big5.c39
-rw-r--r--tests/mysql_client_test.c2
8 files changed, 66 insertions, 6 deletions
diff --git a/bdb/btree/bt_open.c b/bdb/btree/bt_open.c
index 0b72391c267..24da41e9893 100644
--- a/bdb/btree/bt_open.c
+++ b/bdb/btree/bt_open.c
@@ -489,7 +489,7 @@ __bam_new_file(dbp, txn, fhp, name)
goto err;
} else {
#ifdef DIAGNOSTIC
- memset(buf, dbp->pgsize, 0);
+ memset(buf, 0, dbp->pgsize);
#endif
root = (PAGE *)buf;
}
diff --git a/bdb/hash/hash_open.c b/bdb/hash/hash_open.c
index 041a1df1e7b..f976f5b6816 100644
--- a/bdb/hash/hash_open.c
+++ b/bdb/hash/hash_open.c
@@ -409,7 +409,7 @@ __ham_new_file(dbp, txn, fhp, name)
goto err;
} else {
#ifdef DIAGNOSTIC
- memset(buf, dbp->pgsize, 0);
+ memset(buf, 0, dbp->pgsize);
#endif
page = (PAGE *)buf;
}
diff --git a/client/mysql.cc b/client/mysql.cc
index 46bfc7d880f..0c229796c1e 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -3073,9 +3073,14 @@ void tee_fprintf(FILE *file, const char *fmt, ...)
#ifdef OS2
fflush( file);
#endif
+ va_end(args);
+
if (opt_outfile)
+ {
+ va_start(args, fmt);
(void) vfprintf(OUTFILE, fmt, args);
- va_end(args);
+ va_end(args);
+ }
}
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index 8f4ee3d0558..c63704f6d9d 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -77,3 +77,10 @@ big5_bin 6109
big5_bin 61
big5_bin 6120
drop table t1;
+SET NAMES big5;
+CREATE TABLE t1 (a text) character set big5;
+INSERT INTO t1 VALUES ('ùØ');
+SELECT * FROM t1;
+a
+ùØ
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index 8b75123ca32..b5cf610d941 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -16,3 +16,12 @@ SET collation_connection='big5_chinese_ci';
-- source include/ctype_filesort.inc
SET collation_connection='big5_bin';
-- source include/ctype_filesort.inc
+
+#
+# Bugs#9357: TEXT columns break string with special word in BIG5 charset.
+#
+SET NAMES big5;
+CREATE TABLE t1 (a text) character set big5;
+INSERT INTO t1 VALUES ('ùØ');
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/ndb/src/kernel/vm/VMSignal.cpp b/ndb/src/kernel/vm/VMSignal.cpp
index bffca6f6541..e4eafb47ff7 100644
--- a/ndb/src/kernel/vm/VMSignal.cpp
+++ b/ndb/src/kernel/vm/VMSignal.cpp
@@ -18,8 +18,8 @@
#include <string.h>
Signal::Signal(){
- memset(&header, sizeof(header), 0);
- memset(theData, sizeof(theData), 0);
+ memset(&header, 0, sizeof(header));
+ memset(theData, 0, sizeof(theData));
}
void
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 270b02212af..58847a96591 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -6271,6 +6271,43 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
+
+/*
+ Returns a well formed length of a BIG5 string.
+ CP950 and HKSCS additional characters are also accepted.
+*/
+static
+uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)),
+ const char *b, const char *e, uint pos)
+{
+ const char *b0= b;
+ const char *emb= e - 1; /* Last possible end of an MB character */
+ while (pos && b < e)
+ {
+ /*
+ Cast to int8 for extra safety. "char" can be unsigned
+ by default on some platforms.
+ */
+ if (((int8)b[0]) >= 0)
+ {
+ /* Single byte ascii character */
+ b++;
+ }
+ else if ((b < emb) && isbig5code((uchar)*b, (uchar)b[1]))
+ {
+ /* Double byte character */
+ b+= 2;
+ }
+ else
+ {
+ /* Wrong byte sequence */
+ break;
+ }
+ }
+ return b - b0;
+}
+
+
static MY_COLLATION_HANDLER my_collation_big5_chinese_ci_handler =
{
NULL, /* init */
@@ -6291,7 +6328,7 @@ static MY_CHARSET_HANDLER my_charset_big5_handler=
mbcharlen_big5,
my_numchars_mb,
my_charpos_mb,
- my_well_formed_len_mb,
+ my_well_formed_len_big5,
my_lengthsp_8bit,
my_numcells_8bit,
my_mb_wc_big5, /* mb_wc */
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 3974bacc2eb..cb274682f9b 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -11617,6 +11617,7 @@ static void test_bug7990()
static void test_bug8378()
{
+#ifdef HAVE_CHARSET_gbk
MYSQL *lmysql;
char out[9]; /* strlen(TEST_BUG8378)*2+1 */
int len;
@@ -11651,6 +11652,7 @@ static void test_bug8378()
DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0);
mysql_close(lmysql);
+#endif
}
/*