From: eugene Date: October 10 2006 5:27pm Subject: bk commit into 5.0 tree (evgen:1.2298) BUG#22138 List-Archive: http://lists.mysql.com/commits/13418 X-Bug: 22138 Message-Id: <20061010172746.4716122E205@moonbone.moonbone.local> 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@stripped, 2006-10-10 21:27:43+04:00, evgen@stripped +3 -0 Bug#22138: Unhandled NULL caused server crash The Cached_item_decimal::cmp() method wasn't checking for null pointer returned from the val_decimal() of the item being cached. This leads to server crash. The Cached_item_decimal::cmp() method now check for null values. mysql-test/r/type_decimal.result@stripped, 2006-10-10 21:27:02+04:00, evgen@stripped +11 -0 Added the test case for bug#22138: Unhandled NULL caused server crash mysql-test/t/type_decimal.test@stripped, 2006-10-10 21:26:49+04:00, evgen@stripped +9 -0 Added the test case for bug#22138: Unhandled NULL caused server crash sql/item_buff.cc@stripped, 2006-10-10 21:27:14+04:00, evgen@stripped +5 -2 Bug#22138: Unhandled NULL caused server crash The Cached_item_decimal::cmp() method now check for null values. # 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/22138-bug-5.0-opt-mysql --- 1.19/sql/item_buff.cc 2006-10-10 21:27:46 +04:00 +++ 1.20/sql/item_buff.cc 2006-10-10 21:27:46 +04:00 @@ -132,10 +132,13 @@ { my_decimal tmp; my_decimal *ptmp= item->val_decimal(&tmp); - if (null_value != item->null_value || my_decimal_cmp(&value, ptmp)) + if (null_value != item->null_value || + (!null_value && my_decimal_cmp(&value, ptmp))) { null_value= item->null_value; - my_decimal2decimal(ptmp, &value); + /* Save only not null values */ + if (!null_value) + my_decimal2decimal(ptmp, &value); return TRUE; } return FALSE; --- 1.41/mysql-test/r/type_decimal.result 2006-10-10 21:27:46 +04:00 +++ 1.42/mysql-test/r/type_decimal.result 2006-10-10 21:27:46 +04:00 @@ -779,3 +779,14 @@ f1 40 drop table t1; +create table t1 as +select from_days(s) as date,t +from (select 1 as s,'t' as t union select null, null ) as sub1; +select group_concat(t) from t1 group by week(date)/10; +group_concat(t) +t +Warnings: +Warning 1292 Truncated incorrect datetime value: '0000-00-00' +Warning 1292 Truncated incorrect datetime value: '0000-00-00' +Warning 1292 Truncated incorrect datetime value: '0000-00-00' +drop table t1; --- 1.31/mysql-test/t/type_decimal.test 2006-10-10 21:27:46 +04:00 +++ 1.32/mysql-test/t/type_decimal.test 2006-10-10 21:27:46 +04:00 @@ -385,3 +385,12 @@ flush tables; select f1 from t1 where f1 in (select f1 from t1); drop table t1; + +# +# Bug#22183: Unhandled NULL caused server crash +# +create table t1 as + select from_days(s) as date,t + from (select 1 as s,'t' as t union select null, null ) as sub1; +select group_concat(t) from t1 group by week(date)/10; +drop table t1;