diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2021-02-23 23:38:57 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2021-02-24 14:15:37 +0300 |
commit | f83e2ecc501573cc500c2ee420e868a40b7910f2 (patch) | |
tree | dcedd1d3b2f0440ff26278b86043ce725e1e54ef /sql/opt_range.h | |
parent | f159061510c229893a88cb2bc1c520241465b172 (diff) | |
download | mariadb-git-f83e2ecc501573cc500c2ee420e868a40b7910f2.tar.gz |
MDEV-24953: 10.5.9 crashes with large IN() list
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.
Diffstat (limited to 'sql/opt_range.h')
-rw-r--r-- | sql/opt_range.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/opt_range.h b/sql/opt_range.h index 50cd43c0e85..1014176ecc5 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -316,6 +316,8 @@ public: */ uint weight; enum { MAX_WEIGHT = 32000 }; + + void update_weight_locally(); #ifndef DBUG_OFF uint verify_weight(); #endif |