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

MDEV-19049 Server crashes in check_duplicate_long_entry_key, ASAN stack-buffer-overflow in Field_blob::get_key_image

Long Unique keys should always be last unique key.
This commit is contained in:
Sachin
2019-06-19 10:35:39 +05:30
parent 9e0ed0fabd
commit 04ee96199e
4 changed files with 47 additions and 38 deletions

View File

@ -2773,6 +2773,7 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
- UNIQUE keys where all column are NOT NULL
- UNIQUE keys that don't contain partial segments
- Other UNIQUE keys
- LONG UNIQUE keys
- Normal keys
- Fulltext keys
@ -2796,6 +2797,14 @@ static int sort_keys(KEY *a, KEY *b)
{
if (!(b_flags & HA_NOSAME))
return -1;
/*
Long Unique keys should always be last unique key.
Before this patch they used to change order wrt to partial keys (MDEV-19049)
*/
if (a->algorithm == HA_KEY_ALG_LONG_HASH)
return 1;
if (b->algorithm == HA_KEY_ALG_LONG_HASH)
return -1;
if ((a_flags ^ b_flags) & HA_NULL_PART_KEY)
{
/* Sort NOT NULL keys before other keys */