diff options
author | Tor Didriksen <tor.didriksen@sun.com> | 2010-06-23 08:13:34 +0200 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@sun.com> | 2010-06-23 08:13:34 +0200 |
commit | ec537a1ad1d5a328b0f76b0e99f10e782fa48f4d (patch) | |
tree | ff4adc659727033439acc82c9207a6e5b9e250cc /sql/sql_select.cc | |
parent | ef4c0f68d12ac8d86f57550599a1be24aa9c6bfe (diff) | |
download | mariadb-git-ec537a1ad1d5a328b0f76b0e99f10e782fa48f4d.tar.gz |
Backport of Bug#53236 Segfault in DTCollation::set(DTCollation&)
Don't call member functions for a NIL pointer.
mysql-test/r/subselect4.result:
Add test case.
mysql-test/t/subselect4.test:
Add test case.
sql/sql_select.cc:
If the (virtual) member function clone_item() returns NULL,
there is no substitution to be made, and we don't need to set the collation.
The test was invoking Item_cache::clone_item()
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index cf8f258d08d..d9b6bff0663 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8629,10 +8629,9 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list, left_item->collation.collation == value->collation.collation)) { Item *tmp=value->clone_item(); - tmp->collation.set(right_item->collation); - if (tmp) { + tmp->collation.set(right_item->collation); thd->change_item_tree(args + 1, tmp); func->update_used_tables(); if ((functype == Item_func::EQ_FUNC || functype == Item_func::EQUAL_FUNC) @@ -8653,10 +8652,9 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list, right_item->collation.collation == value->collation.collation)) { Item *tmp= value->clone_item(); - tmp->collation.set(left_item->collation); - if (tmp) { + tmp->collation.set(left_item->collation); thd->change_item_tree(args, tmp); value= tmp; func->update_used_tables(); |