Skip to content

Commit ccf2886

Browse files
committed
MDEV-37438: UBSAN add_ext_keyuse_for_splitting downcast Item_func_equal -> Item_func_eq
add_ext_keyuse_for_splitting assumed the added_key_field->cond was of type Item_func_eq. In 11.8 there are cases where this is actually of type Item_func_equal in some cases which is not a class descendant of Item_func_eq. The only use of this class is accessing its arguments() method which is defined all the way up the hierarchy of both Item_func_equal and Item_func_eq in the class Item_args. To resolve future mis-castings of this method we assume the topmost class of Item_args.
1 parent b195b8b commit ccf2886

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/opt_split.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ add_ext_keyuse_for_splitting(Dynamic_array<KEYUSE_EXT> *ext_keyuses,
649649
possible_keys.intersect(field->table->keys_usable_for_splitting);
650650
tab->keys.merge(possible_keys);
651651

652-
Item_func_eq *eq_item= (Item_func_eq *) (added_key_field->cond);
652+
Item_args *eq_item= (Item_args *) (added_key_field->cond);
653653
keyuse_ext.table= field->table;
654654
keyuse_ext.val= eq_item->arguments()[1];
655655
keyuse_ext.key= key;

0 commit comments

Comments
 (0)