mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 07:45:44 +00:00
MDEV-31403: Server crashes in st_join_table::choose_best_splitting
The code in choose_best_splitting() assumed that the join prefix is in join->positions[]. This is not necessarily the case. This function might be called when the join prefix is in join->best_positions[], too. Follow the approach from best_access_path(), which calls this function: pass the current join prefix as an argument, "const POSITION *join_positions" and use that.
This commit is contained in:
@ -948,6 +948,7 @@ void reset_validity_vars_for_keyuses(KEYUSE_EXT *key_keyuse_ext_start,
|
||||
|
||||
SplM_plan_info * JOIN_TAB::choose_best_splitting(uint idx,
|
||||
table_map remaining_tables,
|
||||
const POSITION *join_positions,
|
||||
table_map *spl_pd_boundary)
|
||||
{
|
||||
SplM_opt_info *spl_opt_info= table->spl_opt_info;
|
||||
@ -1045,7 +1046,7 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(uint idx,
|
||||
else
|
||||
{
|
||||
table_map last_found= this->table->map;
|
||||
for (POSITION *pos= &this->join->positions[idx - 1]; ; pos--)
|
||||
for (const POSITION *pos= &join_positions[idx - 1]; ; pos--)
|
||||
{
|
||||
if (pos->table->table->map & excluded_tables)
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user