1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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()
This commit is contained in:
Tor Didriksen
2010-06-23 08:13:34 +02:00
parent ef4c0f68d1
commit ec537a1ad1
3 changed files with 56 additions and 4 deletions

View File

@ -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();