Commit 23041af7 authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-21341: Fix UBSAN failures, part 8: fix error in compare_fields_by_table_order

Dont assign Item_field variables to point to Item_string objects (even if we
don't make any dangerous calls for them).
parent 4635047c
......@@ -13669,12 +13669,16 @@ static int compare_fields_by_table_order(Item *field1,
{
int cmp= 0;
bool outer_ref= 0;
Item_field *f1= (Item_field *) (field1->real_item());
Item_field *f2= (Item_field *) (field2->real_item());
if (field1->const_item() || f1->const_item())
Item *field1_real= field1->real_item();
Item *field2_real= field2->real_item();
if (field1->const_item() || field1_real->const_item())
return 1;
if (field2->const_item() || f2->const_item())
if (field2->const_item() || field2_real->const_item())
return -1;
Item_field *f1= (Item_field *) field1_real;
Item_field *f2= (Item_field *) field2_real;
if (f2->used_tables() & OUTER_REF_TABLE_BIT)
{
outer_ref= 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment