Below is the list of changes that have just been committed into a local
4.1 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.2163 05/02/15 11:31:01 jimw@stripped +2 -0
Only escape the first character in a sequence of bytes that appears to be
a multibyte character, but was not a valid multibyte character. Refinement
of fix for Bug #8378.
mysys/charset.c
1.132 05/02/15 09:46:50 jimw@stripped +6 -9
Fix to only escape the first character in a sequence that appears
to be a multibyte character, but was not a valid one.
tests/mysql_client_test.c
1.148 05/02/15 09:46:12 jimw@stripped +10 -10
Fix test (and fix number) for Bug #8378
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jimw
# Host: rama.(none)
# Root: /home/jimw/my/mysql-4.1-8378
--- 1.131/mysys/charset.c 2005-02-09 15:27:34 -08:00
+++ 1.132/mysys/charset.c 2005-02-15 09:46:50 -08:00
@@ -583,9 +583,10 @@
}
/*
If the next character appears to begin a multi-byte character, we
- escape all of the bytes of that apparent character. (The character just
- looks like a multi-byte character -- if it were actually a multi-byte
- character, it would have been passed through in the test above.)
+ escape that first byte of that apparent multi-byte character. (The
+ character just looks like a multi-byte character -- if it were actually
+ a multi-byte character, it would have been passed through in the test
+ above.)
Without this check, we can create a problem by converting an invalid
multi-byte character into a valid one. For example, 0xbf27 is not
@@ -593,12 +594,8 @@
*/
if (use_mb_flag && (l= my_mbcharlen(charset_info, *from)) > 1)
{
- while (l--)
- {
- *to++= '\\';
- *to++= *from++;
- }
- from--;
+ *to++= '\\';
+ *to++= *from;
continue;
}
#endif
--- 1.147/tests/mysql_client_test.c 2005-02-09 15:26:53 -08:00
+++ 1.148/tests/mysql_client_test.c 2005-02-15 09:46:12 -08:00
@@ -11535,20 +11535,20 @@
/*
Test mysql_real_escape_string() with gbk charset
- The important part is that 0x27 (') is the second-byte in a invvalid
+ The important part is that 0x27 (') is the second-byte in a invalid
two-byte GBK character here. But 0xbf5c is a valid GBK character, so
- it needs to be escaped as 0x5cbf5c27
+ it needs to be escaped as 0x5cbf27
*/
-#define TEST_BUG8317_IN "\xef\xbb\xbf\x27"
-#define TEST_BUG8317_OUT "\xef\xbb\x5c\xbf\x5c\x27"
+#define TEST_BUG8378_IN "\xef\xbb\xbf\x27\xbf\x10"
+#define TEST_BUG8378_OUT "\xef\xbb\x5c\xbf\x5c\x27\x5c\xbf\x10"
-static void test_bug8317()
+static void test_bug8378()
{
MYSQL *lmysql;
- char out[9]; /* strlen(TEST_BUG8317)*2+1 */
+ char out[9]; /* strlen(TEST_BUG8378)*2+1 */
int len;
- myheader("test_bug8317");
+ myheader("test_bug8378");
if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ...");
@@ -11572,10 +11572,10 @@
if (!opt_silent)
fprintf(stdout, " OK");
- len= mysql_real_escape_string(lmysql, out, TEST_BUG8317_IN, 4);
+ len= mysql_real_escape_string(lmysql, out, TEST_BUG8378_IN, 4);
/* No escaping should have actually happened. */
- DIE_UNLESS(memcmp(out, TEST_BUG8317_OUT, len) == 0);
+ DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0);
mysql_close(lmysql);
}
@@ -11787,7 +11787,7 @@
{ "test_conversion", test_conversion },
{ "test_rewind", test_rewind },
{ "test_bug6761", test_bug6761 },
- { "test_bug8317", test_bug8317 },
+ { "test_bug8378", test_bug8378 },
{ 0, 0 }
};
| Thread |
|---|
| • bk commit into 4.1 tree (jimw:1.2163) | Jim Winstead | 15 Feb |