List:Commits« Previous MessageNext Message »
From:holyfoot Date:October 30 2007 8:35am
Subject:bk commit into 4.1 tree (holyfoot:1.2688) BUG#31758
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of hf. When hf 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, 2007-10-30 12:35:03+04:00, holyfoot@stripped +3 -0
  Bug #31758 inet_ntoa, oct crashes server with null+filesort
  
  Item_func_inet_ntoa and Item_func_conv inherit 'maybe_null' flag from an
  argument, which is wrong.
  Both can be NULL with notnull arguments, so that's fixed.

  mysql-test/r/func_str.result@stripped, 2007-10-30 12:35:02+04:00, holyfoot@stripped +15 -3
    Bug #31758 inet_ntoa, oct crashes server with null+filesort
    
    test case

  mysql-test/t/func_str.test@stripped, 2007-10-30 12:35:02+04:00, holyfoot@stripped +13 -0
    Bug #31758 inet_ntoa, oct crashes server with null+filesort
    
    test result

  sql/item_strfunc.h@stripped, 2007-10-30 12:35:02+04:00, holyfoot@stripped +2 -1
    Bug #31758 inet_ntoa, oct crashes server with null+filesort
    
    missing maybe_null flags set for Item_func_inet_ntoa and Item_func_conv

diff -Nrup a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
--- a/mysql-test/r/func_str.result	2007-01-11 17:43:01 +04:00
+++ b/mysql-test/r/func_str.result	2007-10-30 12:35:02 +04:00
@@ -711,9 +711,9 @@ Warning	1265	Data truncated for column '
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `bin(130)` char(64) NOT NULL default '',
-  `oct(130)` char(64) NOT NULL default '',
-  `conv(130,16,10)` char(64) NOT NULL default '',
+  `bin(130)` char(64) default NULL,
+  `oct(130)` char(64) default NULL,
+  `conv(130,16,10)` char(64) default NULL,
   `hex(130)` char(6) NOT NULL default '',
   `char(130)` char(1) NOT NULL default '',
   `format(130,10)` char(4) NOT NULL default '',
@@ -1075,5 +1075,17 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	0	const row not found
 Warnings:
 Note	1003	select decode(test.t1.f1,'zxcv') AS `enc` from test.t1
+drop table t1;
+create table t1 (a bigint not null)engine=myisam;
+insert into t1 set a = 1024*1024*1024*4;
+delete from t1 order by (inet_ntoa(a)) desc limit 10;
+drop table t1;
+create table t1 (a char(36) not null)engine=myisam;
+insert ignore into t1 set a = ' ';
+insert ignore into t1 set a = ' ';
+select * from t1 order by (oct(a));
+a
+
+
 drop table t1;
 End of 4.1 tests
diff -Nrup a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
--- a/mysql-test/t/func_str.test	2007-01-11 17:42:29 +04:00
+++ b/mysql-test/t/func_str.test	2007-10-30 12:35:02 +04:00
@@ -721,4 +721,17 @@ explain extended select encode(f1,'zxcv'
 explain extended select decode(f1,'zxcv') as 'enc' from t1;
 drop table t1;
 
+#
+# Bug #31758 inet_ntoa, oct, crashes server with null + filesort 
+#
+create table t1 (a bigint not null)engine=myisam;
+insert into t1 set a = 1024*1024*1024*4;
+delete from t1 order by (inet_ntoa(a)) desc limit 10;
+drop table t1;
+create table t1 (a char(36) not null)engine=myisam;
+insert ignore into t1 set a = ' ';
+insert ignore into t1 set a = ' ';
+select * from t1 order by (oct(a));
+drop table t1;
+
 --echo End of 4.1 tests
diff -Nrup a/sql/item_strfunc.h b/sql/item_strfunc.h
--- a/sql/item_strfunc.h	2007-01-11 17:44:43 +04:00
+++ b/sql/item_strfunc.h	2007-10-30 12:35:02 +04:00
@@ -531,6 +531,7 @@ public:
   {
     collation.set(default_charset());
     decimals=0; max_length=64;
+    maybe_null= 1;
   }
 };
 
@@ -623,7 +624,7 @@ public:
     }
   String* val_str(String* str);
   const char *func_name() const { return "inet_ntoa"; }
-  void fix_length_and_dec() { decimals = 0; max_length=3*8+7; }
+  void fix_length_and_dec() { decimals = 0; max_length=3*8+7; maybe_null=1;}
 };
 
 class Item_func_quote :public Item_str_func
Thread
bk commit into 4.1 tree (holyfoot:1.2688) BUG#31758holyfoot30 Oct