Commit f7316aa0 authored by Ajo Robert's avatar Ajo Robert

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.
parent f2f6025a
#ifndef ITEM_INCLUDED #ifndef ITEM_INCLUDED
#define ITEM_INCLUDED #define ITEM_INCLUDED
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -1552,6 +1552,12 @@ class Item_name_const : public Item ...@@ -1552,6 +1552,12 @@ class Item_name_const : public Item
return TRUE; return TRUE;
} }
virtual bool cache_const_expr_analyzer(uchar **arg)
{
// Item_name_const always wraps a literal, so there is no need to cache it.
return false;
}
int save_in_field(Field *field, bool no_conversions) int save_in_field(Field *field, bool no_conversions)
{ {
return value_item->save_in_field(field, no_conversions); return value_item->save_in_field(field, no_conversions);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment