MDEV-26351 segfault - (MARIA_HA *) 0x0 in ha_maria::extra

don't let Aria create a table that it cannot open
This commit is contained in:
Sergei Golubchik 2022-02-10 13:40:03 +01:00
parent 1b8bb44106
commit 9e2c26b0f6
3 changed files with 5 additions and 5 deletions

View File

@ -2630,5 +2630,5 @@ b as c2624,
b as c2626
from t1
) as tt1;
ERROR HY000: Index for table 'tmp' is corrupt; try to repair it
ERROR 0A000: Aria table 'tmp' has too many columns and/or indexes and/or unique constraints.
drop table t1;

View File

@ -6,7 +6,7 @@ create table t1 (
) engine=innodb;
--replace_regex /'.*'/'tmp'/
--error 126
--error 140
create table t2 as
select
1

View File

@ -716,9 +716,10 @@ int maria_create(const char *name, enum data_file_type datafile_type,
share.base.extra_options|= MA_EXTRA_OPTIONS_INSERT_ORDER;
}
share.state.state.key_file_length= MY_ALIGN(info_length, maria_block_size);
DBUG_PRINT("info", ("info_length: %u", info_length));
/* There are only 16 bits for the total header length. */
if (info_length > 65535)
if (share.state.state.key_file_length > 65535)
{
my_printf_error(HA_WRONG_CREATE_OPTION,
"Aria table '%s' has too many columns and/or "
@ -775,8 +776,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
maria_set_all_keys_active(share.state.key_map, keys);
share.base.keystart = share.state.state.key_file_length=
MY_ALIGN(info_length, maria_block_size);
share.base.keystart = share.state.state.key_file_length;
share.base.max_key_block_length= maria_block_size;
share.base.max_key_length=ALIGN_SIZE(max_key_length+4);
share.base.records=ci->max_rows;