summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2020-05-15 16:17:15 +0300
committerAleksey Midenkov <midenok@gmail.com>2020-05-15 16:17:15 +0300
commita4996f951d731322acc63033646d950ddbb0f60c (patch)
treea82b31076a630e302e26892e653597d47a749ad2 /sql/item.h
parent72789e4b2b0f631635297c6bc785c7364d60ca9f (diff)
downloadmariadb-git-a4996f951d731322acc63033646d950ddbb0f60c.tar.gz
MDEV-22563 Segfault on duplicate free of Item_func_in::array
Same array instance in two Item_func_in instances. First Item_func_in instance is freed on table close. Second one is freed on cleanup_after_query(). get_copy() depends on copy ctor for copying an item and hence does shallow copy for default copy ctor. Use build_clone() for deep copy of Item_func_in.
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h
index 54eaaaf8743..b83b997323d 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1586,6 +1586,7 @@ public:
virtual bool is_order_clause_position() const { return false; }
/* cloning of constant items (0 if it is not const) */
virtual Item *clone_item(THD *thd) { return 0; }
+ /* deep copy item */
virtual Item* build_clone(THD *thd) { return get_copy(thd); }
virtual cond_result eq_cmp_result() const { return COND_OK; }
inline uint float_length(uint decimals_par) const
@@ -2031,6 +2032,10 @@ public:
virtual bool check_index_dependence(void *arg) { return 0; }
/*============== End of Item processor list ======================*/
+ /*
+ Does not guarantee deep copy (depends on copy ctor).
+ See build_clone() for deep copy.
+ */
virtual Item *get_copy(THD *thd)=0;
bool cache_const_expr_analyzer(uchar **arg);