• Sergey Glukhov's avatar
    Bug#16095534 CRASH: PREPARED STATEMENT CRASHES IN ITEM_BOOL_FUNC2::FIX_LENGTH_AND_DEC · 2ec9dcf6
    Sergey Glukhov authored
    The problem happened due to broken left expression in Item_in_optimizer object.
    In case of the bug left expression is runtime created Item_outer_ref item which
    is deleted at the end of the statement and one of Item_in_optimizer arguments
    becomes bad when re-executed. The fix is to use real_item() instead of original
    left expression. Note: It feels a bit weird that after preparing, the field is
    directly part of the generated Item_func_eq, whereas in execution it is replaced
    with an Item_outer_ref wrapper object.
    
    
    sql/item_subselect.cc:
      use left_expr->real_item() instead of original left expression
      because left_expr can be runtime created Ref item which is deleted
      at the end of the statement. Thus one of 'substitution' arguments
      can be broken in case of PS.
    2ec9dcf6
item_subselect.cc 72.7 KB