List:Commits« Previous MessageNext Message »
From:igor Date:March 22 2007 8:05am
Subject:bk commit into 5.0 tree (igor:1.2490) BUG#27362
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of igor. When igor 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-03-22 00:05:36-07:00, igor@stripped +3 -0
  Fixed bug #27362: crash at evaluation of IN predicate when one
  of its argument happened to be a decimal expression returning
  the NULL value.
  The crash was due to the fact the function in_decimal::set did
  not take into account that val_decimal() could return 0 if 
  the decimal expression had been evaluated to NULL.  

  mysql-test/r/func_in.result@stripped, 2007-03-22 00:05:34-07:00, igor@stripped +5 -0
    Added a test case for bug #27362.

  mysql-test/t/func_in.test@stripped, 2007-03-22 00:05:34-07:00, igor@stripped +11 -0
    Added a test case for bug #27362.

  sql/item_cmpfunc.cc@stripped, 2007-03-22 00:05:34-07:00, igor@stripped +2 -1
    Fixed bug #27362: crash at evaluation of IN predicate when one
    of its argument happened to be a decimal expression returning
    the NULL value.
    The crash was due to the fact the function in_decimal::set did
    not take into account that val_decimal() could return 0 if 
    the decimal expression had been evaluated to NULL.  

# 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:	igor
# Host:	olga.mysql.com
# Root:	/home/igor/dev-opt/mysql-5.0-opt-bug27362

--- 1.239/sql/item_cmpfunc.cc	2007-03-22 00:05:41 -07:00
+++ 1.240/sql/item_cmpfunc.cc	2007-03-22 00:05:41 -07:00
@@ -2423,7 +2423,8 @@
   dec->len= DECIMAL_BUFF_LENGTH;
   dec->fix_buffer_pointer();
   my_decimal *res= item->val_decimal(dec);
-  if (res != dec)
+  /* if item->val_decimal() is evaluated to NULL then res == 0 */ 
+  if (!item->null_value && res != dec)
     my_decimal2decimal(res, dec);
 }
 

--- 1.33/mysql-test/r/func_in.result	2007-03-22 00:05:41 -07:00
+++ 1.34/mysql-test/r/func_in.result	2007-03-22 00:05:41 -07:00
@@ -470,4 +470,9 @@
 Warnings:
 Warning	1292	Incorrect date value: '19772-07-29' for column 'a' at row 1
 DROP TABLE t1,t2,t3,t4;
+CREATE TABLE t1 (id int not null);
+INSERT INTO t1 VALUES (1),(2);
+SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) );
+id
+DROP TABLE t1;
 End of 5.0 tests

--- 1.27/mysql-test/t/func_in.test	2007-03-22 00:05:41 -07:00
+++ 1.28/mysql-test/t/func_in.test	2007-03-22 00:05:41 -07:00
@@ -360,4 +360,15 @@
 
 DROP TABLE t1,t2,t3,t4;
 
+#
+# BUG#27362: IN with a decimal expression that may return NULL
+#
+
+CREATE TABLE t1 (id int not null);
+INSERT INTO t1 VALUES (1),(2);
+
+SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) );
+
+DROP TABLE t1;
+
 --echo End of 5.0 tests
Thread
bk commit into 5.0 tree (igor:1.2490) BUG#27362igor22 Mar