summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-01-10 00:27:11 -0800
committerunknown <igor@olga.mysql.com>2007-01-10 00:27:11 -0800
commit6fc17dab1ec371ca2849a6df8661b5420d1cb255 (patch)
treece7c35c4bbf327fcd8e1c81681d199433b1eec9f /sql/item.cc
parent8e0eea0d336fe259a753ebc380bc85cf31b29599 (diff)
downloadmariadb-git-6fc17dab1ec371ca2849a6df8661b5420d1cb255.tar.gz
Fixed bug #25427.
In the method Item_field::fix_fields we try to resolve the name of the field against the names of the aliases that occur in the select list. This is done by a call of the function find_item_in_list. When this function finds several occurrences of the field name it sends an error message to the error queue and returns 0. Yet the code did not take into account that find_item_in_list could return 0 and tried to dereference the returned value. mysql-test/r/order_by.result: Added a test case for bug #25427. mysql-test/t/order_by.test: Added a test case for bug #25427. sql/item.cc: Fixed bug #25427. In the method Item_field::fix_fields we try to resolve the name of the field against the names of the aliases that occur in the select list. This is done by a call of the function find_item_in_list. When this function finds several occurrences of the field name it sends an error message to the error queue and returns 0. Yet the code did not take into account that find_item_in_list could return 0 and tried to dereference the returned value.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 45d7856b2c1..1e8c70c6616 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1761,6 +1761,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
Item** res= find_item_in_list(this, thd->lex->current_select->item_list,
&counter, REPORT_EXCEPT_NOT_FOUND,
&not_used);
+ if (!res)
+ return 1;
if (res != (Item **)not_found_item)
{
if ((*res)->type() == Item::FIELD_ITEM)