summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-01-26 15:04:20 +0200
committerMonty <monty@mariadb.org>2018-01-26 15:04:20 +0200
commit204739df145077621797cd68cc18ecec609675be (patch)
tree6d93d208266b2794c4560522dc355554a61074d6 /sql
parent859d100d70a9dba222b229bbc0d5a01194e8ed5f (diff)
downloadmariadb-git-204739df145077621797cd68cc18ecec609675be.tar.gz
Fixed memory overrun in create_postjoin_aggr_table()
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_select.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6b1d406bf8a..a98477d2839 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2910,6 +2910,7 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields,
THD_STAGE_INFO(thd, stage_sorting_for_group);
if (ordered_index_usage != ordered_index_group_by &&
+ !only_const_tables() &&
(join_tab + const_tables)->type != JT_CONST && // Don't sort 1 row
!implicit_grouping &&
add_sorting_to_table(join_tab + const_tables, group_list))
@@ -2943,6 +2944,7 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields,
THD_STAGE_INFO(thd, stage_sorting_for_order);
if (ordered_index_usage != ordered_index_order_by &&
+ !only_const_tables() &&
add_sorting_to_table(join_tab + const_tables, order))
goto err;
order= NULL;