1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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 61c15ebe32
This commit is contained in:
Sergei Golubchik
2020-08-07 13:37:41 +02:00
parent e081415040
commit cd2924bacb
12 changed files with 93 additions and 10 deletions

View File

@ -6454,7 +6454,8 @@ struct SORT_FIELD_ATTR
*/
bool maybe_null;
CHARSET_INFO *cs;
uint pack_sort_string(uchar *to, String *str) const;
uint pack_sort_string(uchar *to, const Binary_string *str,
CHARSET_INFO *cs) const;
int compare_packed_fixed_size_vals(uchar *a, size_t *a_len,
uchar *b, size_t *b_len);
int compare_packed_varstrings(uchar *a, size_t *a_len,