List:Commits« Previous MessageNext Message »
From:Tatjana A Nuernberg Date:September 4 2006 5:01am
Subject:bk commit into 5.0 tree (tnurnberg:1.2230)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tnurnberg. When tnurnberg 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@stripped, 2006-09-04 07:01:15+02:00, tnurnberg@stripped +3 -0
  Merge salvation.intern.azundris.com:/home/tnurnberg/21913/my41-21913
  into  salvation.intern.azundris.com:/home/tnurnberg/21913/my50-21913
  
  21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver.
  
  Variable character_set_results can legally be NULL (for "no conversion.")
  This could result in a NULL deref that crashed the server.  Fixed.
  
  (Although ran some additional precursory tests to see whether I could break
  anything else, but no breakage so far.)
  MERGE: 1.1616.2658.15

  mysql-test/r/func_time.result@stripped, 2006-09-04 07:01:11+02:00, tnurnberg@stripped +12 -12
    Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver.
    
    Prove DATE_FORMAT() no longer crashes the server when character_set_results is
    NULL (which is a legal value and means, "no conversion").
    MERGE: 1.23.4.5

  mysql-test/t/func_time.test@stripped, 2006-09-04 07:01:11+02:00, tnurnberg@stripped +18 -18
    Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver.
    
    Prove DATE_FORMAT() no longer crashes the server when character_set_results is
    NULL (which is a legal value and means, "no conversion").
    MERGE: 1.21.3.5

  sql/sql_string.cc@stripped, 2006-09-04 07:01:11+02:00, tnurnberg@stripped +0 -0
    Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver.
    
    Avoid NULL deref in my_charset_same() -- if !to_cs, we won't need to compare
    because it is magic for, "no conversion."
    MERGE: 1.77.1.18

# 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:	tnurnberg
# Host:	salvation.intern.azundris.com
# Root:	/home/tnurnberg/21913/my50-21913/RESYNC

--- 1.91/sql/sql_string.cc	2006-09-04 07:01:26 +02:00
+++ 1.92/sql/sql_string.cc	2006-09-04 07:01:26 +02:00
@@ -248,6 +248,10 @@ bool String::copy(const char *str,uint32
    0  No conversion needed
    1  Either character set conversion or adding leading  zeros
       (e.g. for UCS-2) must be done
+
+  NOTE
+  to_cs may be NULL for "no conversion" if the system variable
+  character_set_results is NULL.
 */
 
 bool String::needs_conversion(uint32 arg_length,
@@ -256,7 +260,8 @@ bool String::needs_conversion(uint32 arg
 			      uint32 *offset)
 {
   *offset= 0;
-  if ((to_cs == &my_charset_bin) || 
+  if (!to_cs ||
+      (to_cs == &my_charset_bin) || 
       (to_cs == from_cs) ||
       my_charset_same(from_cs, to_cs) ||
       ((from_cs == &my_charset_bin) &&

--- 1.62/mysql-test/r/func_time.result	2006-09-04 07:01:26 +02:00
+++ 1.63/mysql-test/r/func_time.result	2006-09-04 07:01:26 +02:00
@@ -960,3 +960,15 @@ id	day	id	day
 3	2005-07-01	3	2005-07-15
 DROP TABLE t1,t2;
 set time_zone= @@global.time_zone;
+SET NAMES latin1;
+SET character_set_results = NULL;
+SHOW VARIABLES LIKE 'character_set_results';
+Variable_name	Value
+character_set_results	
+CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
+INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
+SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
+fmtddate	field2
+Sep-4 12:00AM	abcd
+DROP TABLE testBug8868;
+SET NAMES DEFAULT;

--- 1.50/mysql-test/t/func_time.test	2006-09-04 07:01:26 +02:00
+++ 1.51/mysql-test/t/func_time.test	2006-09-04 07:01:26 +02:00
@@ -534,3 +534,21 @@ DROP TABLE t1,t2;
 
 # Restore timezone to default
 set time_zone= @@global.time_zone;
+
+#
+# 21913: DATE_FORMAT() Crashes mysql server if I use it through
+#        mysql-connector-j driver.
+#
+
+SET NAMES latin1;
+SET character_set_results = NULL;
+SHOW VARIABLES LIKE 'character_set_results';
+
+CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
+INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
+
+SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
+
+DROP TABLE testBug8868;
+
+SET NAMES DEFAULT;
Thread
bk commit into 5.0 tree (tnurnberg:1.2230)Tatjana A Nuernberg4 Sep