• Sergei Petrunia's avatar
    MDEV-24953: 10.5.9 crashes with large IN() list · f83e2ecc
    Sergei Petrunia authored
    The problem was in and_all_keys(), the code of MDEV-9759 which calculates
    the new tree weight:
    
    First, it didn't take into account the case when
    
    (next->next_key_part=tmp) == NULL
    
    and dereferenced a NULL pointer when getting tmp->weight.
    
    Second, "if (param->alloced_sel_args > SEL_ARG::MAX_SEL_ARGS) break"
    could leave the loop with incorrect value of weight.
    
    Fixed by introducing SEL_ARG::update_weight_locally() and calling it
    at the end of the function. This allows to avoid caring about all the
    above cases.
    f83e2ecc
range_notembedded.test 4.12 KB