summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-05-29 00:32:08 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-06-05 01:11:03 +0530
commitf30ff10c8d02d8385bafa290b8c73367d49aece2 (patch)
tree12fc921da3dddc00b0a47314182b19bd4eb29540 /sql/field.cc
parent3f019d1771d4e6e21f941b72a83e0663f15b376f (diff)
downloadmariadb-git-f30ff10c8d02d8385bafa290b8c73367d49aece2.tar.gz
MDEV-22715: SIGSEGV in radixsort_for_str_ptr and in native_compare/my_qsort2 (optimized builds)
For DECIMAL[(M[,D])] datatype max_sort_length was not being honoured which was leading to buffer overflow while making the sort key. The fix to this problem would be to create sort keys for decimals with atmost max_sort_key bytes Important: The minimum value of max_sort_length has been raised to 8 (previously was 4), so fixed size datatypes like DOUBLE and BIGINIT are not truncated for lower values of max_sort_length.
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 291e2134dcf..f65c6f88bb9 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -3295,10 +3295,9 @@ int Field_new_decimal::cmp(const uchar *a,const uchar*b)
}
-void Field_new_decimal::sort_string(uchar *buff,
- uint length __attribute__((unused)))
+void Field_new_decimal::sort_string(uchar *buff, uint length)
{
- memcpy(buff, ptr, bin_size);
+ memcpy(buff, ptr, length);
}