MDEV-34227 On startup: UBSAN: runtime error: applying non-zero offset in JOIN::make_aggr_tables_info in sql/sql_select.cc
Avoid undefined behaviour (applying offset to nullptr). The reported scenario is covered in mysql-test/connect-no-db.test No new tests needed.
This commit is contained in:
parent
21f56583bf
commit
246c0b3a35
@ -3325,7 +3325,8 @@ bool JOIN::make_aggr_tables_info()
|
|||||||
{
|
{
|
||||||
List<Item> *curr_all_fields= &all_fields;
|
List<Item> *curr_all_fields= &all_fields;
|
||||||
List<Item> *curr_fields_list= &fields_list;
|
List<Item> *curr_fields_list= &fields_list;
|
||||||
JOIN_TAB *curr_tab= join_tab + const_tables;
|
// Avoid UB (applying .. offset to nullptr) when join_tab is nullptr
|
||||||
|
JOIN_TAB *curr_tab= join_tab ? join_tab + const_tables : nullptr;
|
||||||
TABLE *exec_tmp_table= NULL;
|
TABLE *exec_tmp_table= NULL;
|
||||||
bool distinct= false;
|
bool distinct= false;
|
||||||
bool keep_row_order= false;
|
bool keep_row_order= false;
|
||||||
@ -3883,9 +3884,9 @@ bool JOIN::make_aggr_tables_info()
|
|||||||
- duplicate value removal
|
- duplicate value removal
|
||||||
Both of these operations are done after window function computation step.
|
Both of these operations are done after window function computation step.
|
||||||
*/
|
*/
|
||||||
curr_tab= join_tab + total_join_tab_cnt();
|
|
||||||
if (select_lex->window_funcs.elements)
|
if (select_lex->window_funcs.elements)
|
||||||
{
|
{
|
||||||
|
curr_tab= join_tab + total_join_tab_cnt();
|
||||||
if (!(curr_tab->window_funcs_step= new Window_funcs_computation))
|
if (!(curr_tab->window_funcs_step= new Window_funcs_computation))
|
||||||
DBUG_RETURN(true);
|
DBUG_RETURN(true);
|
||||||
if (curr_tab->window_funcs_step->setup(thd, &select_lex->window_funcs,
|
if (curr_tab->window_funcs_step->setup(thd, &select_lex->window_funcs,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user