diff options
author | Oleg Smirnov <olernov@gmail.com> | 2023-04-25 14:34:31 +0700 |
---|---|---|
committer | Oleg Smirnov <olernov@gmail.com> | 2023-04-28 09:35:27 +0700 |
commit | adbad5e36f99f64eedbcc43f98215f5e52f10cad (patch) | |
tree | 4633455f111f79cb33c966f99adc89af95133c11 /sql/sql_select.cc | |
parent | f21664414da8c4cf26daf5cad012dc0aca028602 (diff) | |
download | mariadb-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.cc | 3 |
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); |