Skip to content

Commit f7316aa

Browse files
author
Ajo Robert
committed
Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST,
COL), NAME_CONST('NAME', NULL)) Backport of Bug#19143243 fix. NAME_CONST item can return NULL_ITEM type in case of incorrect arguments. NULL_ITEM has special processing in Item_func_in function. In Item_func_in::fix_length_and_dec an array of possible comparators is created. Since NAME_CONST function has NULL_ITEM type, corresponding array element is empty. Then NAME_CONST is wrapped to ITEM_CACHE. ITEM_CACHE can not return proper type(NULL_ITEM) in Item_func_in::val_int(), so the NULL_ITEM is attempted compared with an empty comparator. The fix is to disable the caching of Item_name_const item.
1 parent f2f6025 commit f7316aa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sql/item.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef ITEM_INCLUDED
22
#define ITEM_INCLUDED
33

4-
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
4+
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -1552,6 +1552,12 @@ class Item_name_const : public Item
15521552
return TRUE;
15531553
}
15541554

1555+
virtual bool cache_const_expr_analyzer(uchar **arg)
1556+
{
1557+
// Item_name_const always wraps a literal, so there is no need to cache it.
1558+
return false;
1559+
}
1560+
15551561
int save_in_field(Field *field, bool no_conversions)
15561562
{
15571563
return value_item->save_in_field(field, no_conversions);

0 commit comments

Comments
 (0)