List:Commits« Previous MessageNext Message »
From:Tatjana A Nuernberg Date:September 4 2006 3:03am
Subject:bk commit into 4.1 tree (tnurnberg:1.2538) BUG#21913
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 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 05:03:28+02:00, tnurnberg@stripped +3 -0
  Bug#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.)

  mysql-test/r/func_time.result@stripped, 2006-09-04 05:03:25+02:00, tnurnberg@stripped +12 -0
    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").

  mysql-test/t/func_time.test@stripped, 2006-09-04 05:03:25+02:00, tnurnberg@stripped +18 -0
    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").

  sql/sql_string.cc@stripped, 2006-09-04 05:03:25+02:00, tnurnberg@stripped +2 -1
    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."

# 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/my41-21913

--- 1.94/sql/sql_string.cc	2006-09-04 05:03:34 +02:00
+++ 1.95/sql/sql_string.cc	2006-09-04 05:03:34 +02:00
@@ -256,7 +256,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.42/mysql-test/r/func_time.result	2006-09-04 05:03:34 +02:00
+++ 1.43/mysql-test/r/func_time.result	2006-09-04 05:03:34 +02:00
@@ -688,3 +688,15 @@ t1	CREATE TABLE `t1` (
   `from_unixtime(1) + 0` double(23,6) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+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.37/mysql-test/t/func_time.test	2006-09-04 05:03:34 +02:00
+++ 1.38/mysql-test/t/func_time.test	2006-09-04 05:03:34 +02:00
@@ -358,4 +358,22 @@ create table t1 select now() - now(), cu
 show create table t1;
 drop table t1;
 
+#
+# 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;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (tnurnberg:1.2538) BUG#21913Tatjana A Nuernberg4 Sep