1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Fix for MDEV-14141 Crash in print_keydup_error()

May also fix: MDEV-14970 "MariaDB crashed with signal 11 and Aria table"

I am not able to reproduce a crash, however there was no protection in
print_keydup_error() if the storage engine reported the wrong key number.

This patch adds such a protection and should stop any further crashes
in this case.

Other things:
- Added extra protection in Aria to not set errkey to more than number of
  keys. (Don't think this is cause of this crash, but better safe than
  sorry)
- Extend test_if_equal_repl_errors() to handle different cases of
  ER_DUP_ENTRY. This is just mainly precaution for the future.
This commit is contained in:
Monty
2018-01-23 19:21:44 +02:00
parent a4663af05c
commit b3c7cf81e3
6 changed files with 22 additions and 16 deletions

View File

@@ -9612,12 +9612,13 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
if ((int) key_nr >= 0)
{
const char *err_msg= ER(ER_DUP_ENTRY_WITH_KEY_NAME);
if (key_nr == 0 &&
if (key_nr == 0 && to->s->keys > 0 &&
(to->key_info[0].key_part[0].field->flags &
AUTO_INCREMENT_FLAG))
err_msg= ER(ER_DUP_ENTRY_AUTOINCREMENT_CASE);
print_keydup_error(to, key_nr == MAX_KEY ? NULL :
&to->key_info[key_nr],
print_keydup_error(to,
key_nr >= to->s->keys ? NULL :
&to->key_info[key_nr],
err_msg, MYF(0));
}
else