diff options
author | unknown <evgen@moonbone.local> | 2006-10-11 19:44:12 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2006-10-11 19:44:12 +0400 |
commit | 09cfff5f831f3b5eae47ca3ea868c7f3c200ec89 (patch) | |
tree | 667f42f01a14de899bbf9ac1ddaf182fd644b46d /sql | |
parent | b7e4fe3b7fa020c57cbe72b226bdd0d8c4769929 (diff) | |
download | mariadb-git-09cfff5f831f3b5eae47ca3ea868c7f3c200ec89.tar.gz |
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.
sql/item_buff.cc:
Bug#22138: Unhandled NULL caused server crash
The Cached_item_decimal::cmp() method now check for null values.
mysql-test/r/type_decimal.result:
Added the test case for bug#22138: Unhandled NULL caused server crash
mysql-test/t/type_decimal.test:
Added the test case for bug#22138: Unhandled NULL caused server crash
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_buff.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/item_buff.cc b/sql/item_buff.cc index 1661f04a4ae..37f9ca7ce6c 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -132,11 +132,17 @@ bool Cached_item_decimal::cmp() { 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 || + (!item->null_value && my_decimal_cmp(&value, ptmp))) { null_value= item->null_value; - my_decimal2decimal(ptmp, &value); - return TRUE; + /* Save only not null values */ + if (!null_value) + { + my_decimal2decimal(ptmp, &value); + return TRUE; + } + return FALSE; } return FALSE; } |