diff options
author | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-11-27 09:36:43 +0400 |
---|---|---|
committer | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-11-27 09:36:43 +0400 |
commit | ba974f83712e458275ac2a3d2a803c36871cf4f0 (patch) | |
tree | 7e952ab6822831bf606dee0c76147f95905f85f6 /sql/item.cc | |
parent | 1f57bfb8d1ed7f4cbe4a3410752903106cc8d34c (diff) | |
download | mariadb-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.cc')
-rw-r--r-- | sql/item.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc index 431d82af331..a75d0159848 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1209,7 +1209,17 @@ bool Item_name_const::is_null() Item::Type Item_name_const::type() const { - return value_item->type(); + /* + As + 1. one can try to create the Item_name_const passing non-constant + arguments, although it's incorrect and + 2. the type() method can be called before the fix_fields() to get + type information for a further type cast, e.g. + if (item->type() == FIELD_ITEM) + ((Item_field *) item)->... + we return NULL_ITEM in the case to avoid wrong casting. + */ + return valid_args ? value_item->type() : NULL_ITEM; } |