• Sergey Glukhov's avatar
    Bug#58030 crash in Item_func_geometry_from_text::val_str · 8246b5a4
    Sergey Glukhov authored
    Item_sum_max/Item_sum_min incorrectly set null_value flag and
    attempt to get result in parent functions leads to crash.
    This happens due to double evaluation of the function argumet.
    First evaluation happens in the comparator and second one
    happens in Item_cache::cache_value().
    The fix is to introduce new Item_cache object which
    holds result of the argument and use this cached value
    as an argument of the comparator.
    
    mysql-test/r/func_group.result:
      test case
    mysql-test/t/func_group.test:
      test case
    sql/item.cc:
      added assertion that ether we have some result or result is NULL.
    sql/item_sum.cc:
      introduce new Item_cache object which
      holds result of the argument and use this cached value
      as an argument of the comparator.
    sql/item_sum.h:
      introduce new Item_cache object which
      holds result of the argument and use this cached value
      as an argument of the comparator.
    8246b5a4
item_sum.h 42 KB