summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorOleg Smirnov <olernov@gmail.com>2023-04-25 14:34:31 +0700
committerOleg Smirnov <olernov@gmail.com>2023-04-28 09:35:27 +0700
commitadbad5e36f99f64eedbcc43f98215f5e52f10cad (patch)
tree4633455f111f79cb33c966f99adc89af95133c11 /sql/sql_select.cc
parentf21664414da8c4cf26daf5cad012dc0aca028602 (diff)
downloadmariadb-git-adbad5e36f99f64eedbcc43f98215f5e52f10cad.tar.gz
MDEV-31113 Server crashes in store_length / Type_handler_string_result::make_sort_key with DISTINCT and group functionbb-10.4-mdev-31113
Fix-up for commit 476b24d084e7e717310155bb986eb086d3c1e1a6 Author: Monty Date: Thu Feb 16 14:19:33 2023 +0200 MDEV-20057 Distinct SUM on CROSS JOIN and grouped returns wrong result which misses initializing of sorder->suffix_length. In this commit the initialization is implemented by passing MY_ZEROFILL flag to the allocation of SORT_FIELD elements
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 03a2c3d0853..56a185acdd5 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -24226,7 +24226,7 @@ JOIN_TAB::remove_duplicates()
if (!(sortorder= (SORT_FIELD*) my_malloc((fields->elements+1) *
sizeof(SORT_FIELD),
- MYF(MY_WME))))
+ MYF(MY_WME | MY_ZEROFILL))))
DBUG_RETURN(TRUE);
/* Calculate how many saved fields there is in list */
@@ -24245,7 +24245,6 @@ JOIN_TAB::remove_duplicates()
else
{
/* Item is not stored in temporary table, remember it */
- sorder->field= 0; // Safety, not used
sorder->item= item;
/* Calculate sorder->length */
item->type_handler()->sortlength(thd, item, sorder);