summaryrefslogtreecommitdiffstats
path: root/mysql-lowercase-bug.patch
blob: 4387838e78099d0d42d27ab2e62f98cffd68f1f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Fix multiple coding errors related to upstream bug #52019.


diff -Naur mysql-5.1.45.orig/client/mysqltest.cc mysql-5.1.45/client/mysqltest.cc
--- mysql-5.1.45.orig/client/mysqltest.cc	2010-03-01 14:30:46.000000000 -0500
+++ mysql-5.1.45/client/mysqltest.cc	2010-03-25 19:46:36.000000000 -0400
@@ -5586,7 +5586,7 @@
       /* Could be a multibyte character */
       /* This code is based on the code in "sql_load.cc" */
 #ifdef USE_MB
-      int charlen = my_mbcharlen(charset_info, c);
+      int charlen = my_mbcharlen(charset_info, (unsigned char) c);
       /* We give up if multibyte character is started but not */
       /* completed before we pass buf_end */
       if ((charlen > 1) && (p + charlen) <= buf_end)
@@ -5598,16 +5598,16 @@
 
 	for (i= 1; i < charlen; i++)
 	{
+	  c= my_getc(cur_file->file);
 	  if (feof(cur_file->file))
 	    goto found_eof;
-	  c= my_getc(cur_file->file);
 	  *p++ = c;
 	}
 	if (! my_ismbchar(charset_info, mb_start, p))
 	{
 	  /* It was not a multiline char, push back the characters */
 	  /* We leave first 'c', i.e. pretend it was a normal char */
-	  while (p > mb_start)
+	  while (p > mb_start+1)
 	    my_ungetc(*--p);
 	}
       }
@@ -9642,6 +9642,8 @@
 void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
                                const char *val, int len)
 {
+  char lower[512];
+
 #ifdef __WIN__
   fix_win_paths(val, len);
 #endif
@@ -9649,7 +9651,6 @@
   if (display_result_lower) 
   {
     /* Convert to lower case, and do this first */
-    char lower[512];
     char *c= lower;
     for (const char *v= val;  *v;  v++)
       *c++= my_tolower(charset_info, *v);