• Alexander Barkov's avatar
    MDEV-26953 Assertion `!str || str != Ptr || !is_alloced()' failed in... · 3d69213e
    Alexander Barkov authored
    MDEV-26953 Assertion `!str || str != Ptr || !is_alloced()' failed in String::copy upon SELECT with sjis
    
    Item::save_str_in_field() passes &Item::str_value as a parameter
    to val_str().
    
    Item_func::make_empty_result() also fills and returns str_value.
    
    As a result, in the reported scenario in
    Item_func::val_str_from_val_str_ascii()
    both "str" and "res" pointed to Item::str_value,
    which made the DBUG_ASSERT inside String::copy()
    (preventing copying to itself) crash:
    
      if ((null_value= str->copy(res->ptr(), res->length(),
                                 &my_charset_latin1, collation.collation,
                                 &errors)))
    
    Fix:
    - Adding a String* parameter to make_empty_result()
    - Passing the val_str() parameter to make_empty_string().
    3d69213e
item_strfunc.cc 144 KB