mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-35680 Table number > MAX_TABLES causes overflow of table_map at main.join test
Fix a regression introduced by commit d98ac851
(MDEV-29935, MDEV-26247) causing
MAX_TABLES overflow in `setup_table_map()`. The check for MAX_TABLES was moved
outside of the loop that increments table numbers, allowing overflows during
loop iterations. Since setup_table_map() operates on a 64-bit bitmap, table
numbers exceeding 64 triggered the UBSAN check.
This commit returns the overflow check within the loop and adds a debug
assertion to `setup_table_map()` to ensure no bitmap overrun occurs.
This commit is contained in:
@ -7862,11 +7862,15 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
tablenr++;
|
||||
}
|
||||
if (tablenr > MAX_TABLES)
|
||||
{
|
||||
my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast<int>(MAX_TABLES));
|
||||
DBUG_RETURN(1);
|
||||
/*
|
||||
Test MAX_TABLES overflow here inside the loop as setup_table_map()
|
||||
called in each iteration is sensitive for this
|
||||
*/
|
||||
if (tablenr > MAX_TABLES)
|
||||
{
|
||||
my_error(ER_TOO_MANY_TABLES, MYF(0), static_cast<int>(MAX_TABLES));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
if (select_insert && !is_insert_tables_num_set)
|
||||
{
|
||||
|
Reference in New Issue
Block a user