summaryrefslogtreecommitdiff
path: root/sql/unireg.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-08-07 13:37:41 +0200
committerSergei Golubchik <serg@mariadb.org>2020-08-07 13:39:04 +0200
commitcd2924bacbb06596d30f4397b0e200fc9c73e40b (patch)
treeb970692ffd0f2c6ef5e524ae49610d41d0fab23b /sql/unireg.cc
parente08141504011e9a751d3ad1d3d571c725fdc3744 (diff)
downloadmariadb-git-cd2924bacbb06596d30f4397b0e200fc9c73e40b.tar.gz
MDEV-23330 Server crash or ASAN negative-size-param in my_strnncollsp_binary / SORT_FIELD_ATTR::compare_packed_varstrings
and MDEV-23414 Assertion `res->charset() == item->collation.collation' failed in Type_handler_string_result::make_packed_sort_key_part pack_sort_string() *must* take a collation from the Item, not from the String value. Because when casting a string to _binary the original String is not copied for performance reasons, it's reused but its collation does not match Item's collation anymore. Note, that String's collation cannot be simply changed to _binary, because for an Item_string literal the original String must stay unchanged for the duration of the query. this partially reverts 61c15ebe323
Diffstat (limited to 'sql/unireg.cc')
-rw-r--r--sql/unireg.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc
index ae860f0143b..c299549843f 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -86,7 +86,7 @@ static uchar* extra2_write_str(uchar *pos, const LEX_CSTRING &str)
return pos + str.length;
}
-static uchar* extra2_write_str(uchar *pos, Binary_string *str)
+static uchar* extra2_write_str(uchar *pos, const Binary_string *str)
{
pos= extra2_write_len(pos, str->length());
memcpy(pos, str->ptr(), str->length());
@@ -185,7 +185,7 @@ class Field_data_type_info_image: public BinaryStringBuffer<512>
{
return net_store_length(pos, length);
}
- static uchar *store_string(uchar *pos, Binary_string *str)
+ static uchar *store_string(uchar *pos, const Binary_string *str)
{
pos= store_length(pos, str->length());
memcpy(pos, str->ptr(), str->length());