List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:May 7 2005 2:50pm
Subject:bk commit into 4.0 tree (jimw:1.2099) BUG#9864
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 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://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2099 05/05/07 07:50:04 jimw@stripped +1 -0
  Backport fix for escaping multibyte characters. (Bug #9864)

  libmysql/libmysql.c
    1.158 05/05/07 07:48:05 jimw@stripped +34 -0
    Backport fix for escaping multibyte characters from 4.1

# 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.0-9864

--- 1.157/libmysql/libmysql.c	2004-11-04 21:06:54 -08:00
+++ 1.158/libmysql/libmysql.c	2005-05-07 07:48:05 -07:00
@@ -3228,6 +3228,23 @@
       from--;
       continue;
     }
+    /*
+     If the next character appears to begin a multi-byte character, we
+     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
+     a valid GBK character, but 0xbf5c is. (0x27 = ', 0x5c = \)
+    */
+    if (use_mb_flag && (l= my_mbcharlen(charset_info, *from)) > 1)
+    {
+      *to++= '\\';
+      *to++= *from;
+      continue;
+    }
 #endif
     switch (*from) {
     case 0:				/* Must be escaped for 'mysql' */
@@ -3299,6 +3316,23 @@
 	  *to++ = *from++;
 	from--;
 	continue;
+      }
+      /*
+       If the next character appears to begin a multi-byte character, we
+       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
+       a valid GBK character, but 0xbf5c is. (0x27 = ', 0x5c = \)
+      */
+      if (use_mb_flag && (l= my_mbcharlen(mysql->charset, *from)) > 1)
+      {
+        *to++= '\\';
+        *to++= *from;
+        continue;
       }
     }
 #endif
Thread
bk commit into 4.0 tree (jimw:1.2099) BUG#9864Jim Winstead7 May