Below is the list of changes that have just been committed into a local
5.0 repository of andrey. When andrey 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.1909 05/08/29 15:45:03 andrey@lmy004. +3 -0
fix for bug #12841
(Server crash on DO IFNULL(NULL,NULL)
(fixes also "SELECT CAST(IFNULL(NULL,NULL) as DECIMAL)" unreported
crash)
(new revampled fix with suggestions from Igor)
sql/item_func.cc
1.246 05/08/29 15:44:57 andrey@lmy004. +9 -4
don't use the return value of ::str_op() without checking it
whether checking it for NULL. (fixes bug #12841 as well as
another not reported bug, but existing one - test case added).
All other places where ::str_op() is used are safe.
mysql-test/t/select.test
1.73 05/08/29 15:44:57 andrey@lmy004. +9 -0
test for bug #12841
(Server crash on DO IFNULL(NULL,NULL)
mysql-test/r/select.result
1.88 05/08/29 15:44:57 andrey@lmy004. +10 -0
result of test for bug 12841
# 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: andrey
# Host: lmy004.
# Root: /work/mysql-5.0-ready5
--- 1.245/sql/item_func.cc 2005-08-27 06:29:32 +02:00
+++ 1.246/sql/item_func.cc 2005-08-29 15:44:57 +02:00
@@ -734,11 +734,13 @@
case STRING_RESULT:
{
int err_not_used;
- String *res= str_op(&str_value);
+ String *res;
+ if (!(res= str_op(&str_value)))
+ return 0;
+
char *end= (char*) res->ptr() + res->length();
CHARSET_INFO *cs= str_value.charset();
- return (res ? (*(cs->cset->strtoll10))(cs, res->ptr(), &end,
- &err_not_used) : 0);
+ return (*(cs->cset->strtoll10))(cs, res->ptr(), &end,
&err_not_used);
}
default:
DBUG_ASSERT(0);
@@ -769,7 +771,10 @@
}
case STRING_RESULT:
{
- String *res= str_op(&str_value);
+ String *res;
+ if (!(res= str_op(&str_value)))
+ return NULL;
+
str2my_decimal(E_DEC_FATAL_ERROR, (char*) res->ptr(),
res->length(), res->charset(), decimal_value);
break;
--- 1.87/mysql-test/r/select.result 2005-08-23 21:29:02 +02:00
+++ 1.88/mysql-test/r/select.result 2005-08-29 15:44:57 +02:00
@@ -2875,6 +2875,16 @@
1 1 1 1
1 2 2 1
drop table t1, t2, t3;
+DO IFNULL(NULL, NULL);
+SELECT CAST(IFNULL(NULL, NULL) AS DECIMAL);
+CAST(IFNULL(NULL, NULL) AS DECIMAL)
+NULL
+SELECT ABS(IFNULL(NULL, NULL));
+ABS(IFNULL(NULL, NULL))
+NULL
+SELECT IFNULL(NULL, NULL);
+IFNULL(NULL, NULL)
+NULL
create table t1 (a char(1));
create table t2 (a char(1));
insert into t1 values ('a'),('b'),('c');
--- 1.72/mysql-test/t/select.test 2005-08-23 21:29:02 +02:00
+++ 1.73/mysql-test/t/select.test 2005-08-29 15:44:57 +02:00
@@ -2446,6 +2446,15 @@
#
+# Bug #12841: Server crash on DO IFNULL(NULL,NULL)
+#
+# (testing returning of int, decimal, real, string)
+DO IFNULL(NULL, NULL);
+SELECT CAST(IFNULL(NULL, NULL) AS DECIMAL);
+SELECT ABS(IFNULL(NULL, NULL));
+SELECT IFNULL(NULL, NULL);
+
+#
# Bug #6495 Illogical requirement for column qualification in NATURAL join
#
| Thread |
|---|
| • bk commit into 5.0 tree (andrey:1.1909) BUG#12841 | ahristov | 29 Aug |