mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +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:
@@ -3338,9 +3338,11 @@ void print_keydup_error(TABLE *table, KEY *key, const char *msg, myf errflag)
|
||||
|
||||
if (key == NULL)
|
||||
{
|
||||
/* Key is unknown */
|
||||
str.copy("", 0, system_charset_info);
|
||||
my_printf_error(ER_DUP_ENTRY, msg, errflag, str.c_ptr(), "*UNKNOWN*");
|
||||
/*
|
||||
Key is unknown. Should only happen if storage engine reports wrong
|
||||
duplicate key number.
|
||||
*/
|
||||
my_printf_error(ER_DUP_ENTRY, msg, errflag, "", "*UNKNOWN*");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3432,11 +3434,9 @@ void handler::print_error(int error, myf errflag)
|
||||
if (table)
|
||||
{
|
||||
uint key_nr=get_dup_key(error);
|
||||
if ((int) key_nr >= 0)
|
||||
if ((int) key_nr >= 0 && key_nr < table->s->keys)
|
||||
{
|
||||
print_keydup_error(table,
|
||||
key_nr == MAX_KEY ? NULL : &table->key_info[key_nr],
|
||||
errflag);
|
||||
print_keydup_error(table, &table->key_info[key_nr], errflag);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user