MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:eugene Date:December 9 2005 8:01pm
Subject:bk commit into 5.0 tree (evgen:1.1982) BUG#15268
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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.1982 05/12/09 23:01:52 evgen@stripped +3 -0
  Fix bug #15268 Unchecked null value caused server crash
  
  cmp_item_sort_string::cmp() wasn't checking values_res variable for null.
  Later called function was dereferenced it and crashed server.
  
  Added null check to cmp_item_sort_string::cmp().
  

  mysql-test/r/select.result
    1.115 05/12/09 23:01:41 evgen@stripped +8 -0
    Test case for bug#15268 Unchecked null value caused server crash

  mysql-test/t/select.test
    1.94 05/12/09 23:01:28 evgen@stripped +10 -0
    Test case for bug#15268 Unchecked null value caused server crash

  sql/item_cmpfunc.h
    1.117 05/12/09 23:01:15 evgen@stripped +3 -3
    Fix bug#15268  Unchecked null value caused server crash
    Added null check to cmp_item_sort_string::cmp().

# 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:	evgen
# Host:	moonbone.local
# Root:	/work/15268-bug-5.0-mysql

--- 1.116/sql/item_cmpfunc.h	2005-10-21 05:01:31 +04:00
+++ 1.117/sql/item_cmpfunc.h	2005-12-09 23:01:15 +03:00
@@ -723,9 +723,9 @@
   {
     char buff[STRING_BUFFER_USUAL_SIZE];
     String tmp(buff, sizeof(buff), cmp_charset), *res;
-    if (!(res= arg->val_str(&tmp)))
-      return 1;				/* Can't be right */
-    return sortcmp(value_res, res, cmp_charset);
+    res= arg->val_str(&tmp);
+    return (value_res ? (res ? sortcmp(value_res, res, cmp_charset) : 1) :
+            (res ? -1 : 0));
   }
   int compare(cmp_item *c)
   {

--- 1.114/mysql-test/r/select.result	2005-11-26 05:51:39 +03:00
+++ 1.115/mysql-test/r/select.result	2005-12-09 23:01:41 +03:00
@@ -3337,3 +3337,11 @@
 1	SIMPLE	t2	const	PRIMARY	PRIMARY	4	const	1	Using index
 1	SIMPLE	t3	const	PRIMARY	PRIMARY	8	const,const	1	
 DROP TABLE t1,t2,t3;
+create table t1(f1 char, f2 char not null);
+insert into t1 values(null,'a');
+create table t2 (f2 char not null);
+insert into t2 values('b');
+select * from t1 left join t2 on f1=t2.f2 where t1.f2='a';
+f1	f2	f2
+NULL	a	NULL
+drop table t1,t2;

--- 1.93/mysql-test/t/select.test	2005-11-26 05:51:39 +03:00
+++ 1.94/mysql-test/t/select.test	2005-12-09 23:01:28 +03:00
@@ -2805,3 +2805,13 @@
     WHERE t2.key_a=2 and key_b=5;
 
 DROP TABLE t1,t2,t3;
+
+#
+# Bug#15268 Unchecked null value caused server crash
+#
+create table t1(f1 char, f2 char not null);
+insert into t1 values(null,'a');
+create table t2 (f2 char not null);
+insert into t2 values('b');
+select * from t1 left join t2 on f1=t2.f2 where t1.f2='a';
+drop table t1,t2;
Thread
bk commit into 5.0 tree (evgen:1.1982) BUG#15268eugene9 Dec