summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-11-27 09:36:43 +0400
committerunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-11-27 09:36:43 +0400
commitba974f83712e458275ac2a3d2a803c36871cf4f0 (patch)
tree7e952ab6822831bf606dee0c76147f95905f85f6 /sql/item.h
parent1f57bfb8d1ed7f4cbe4a3410752903106cc8d34c (diff)
downloadmariadb-git-ba974f83712e458275ac2a3d2a803c36871cf4f0.tar.gz
Fix for bug #32559: connection hangs on query with name_const
Problem: passing a non-constant name to the NAME_CONST function results in a crash. Fix: check the NAME_CONST name argument; return fake item type if we got non-constant argument(s). mysql-test/r/func_misc.result: Fix for bug #32559: connection hangs on query with name_const - test result. mysql-test/t/func_misc.test: Fix for bug #32559: connection hangs on query with name_const - test case. sql/item.cc: Fix for bug #32559: connection hangs on query with name_const - Item_name_const::type() now returns NULL_ITEM if non-constant arguments were used to create the item to avoid wrong type casting. sql/item.h: Fix for bug #32559: connection hangs on query with name_const - NAME_CONST name argument checked for invariability.
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/item.h b/sql/item.h
index a1135c2c725..fbf4b94b276 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1111,11 +1111,13 @@ class Item_name_const : public Item
{
Item *value_item;
Item *name_item;
+ bool valid_args;
public:
Item_name_const(Item *name_arg, Item *val):
value_item(val), name_item(name_arg)
{
- if(!value_item->basic_const_item())
+ if (!(valid_args= name_item->basic_const_item() &
+ value_item->basic_const_item()))
my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
Item::maybe_null= TRUE;
}