MDEV-29360 Crash when pushing condition with always false IS NULL int…#4788
Draft
mariadb-RexJohnston wants to merge 1 commit into10.11from
Draft
MDEV-29360 Crash when pushing condition with always false IS NULL int…#4788mariadb-RexJohnston wants to merge 1 commit into10.11from
mariadb-RexJohnston wants to merge 1 commit into10.11from
Conversation
…o derived When a condition containing an always FALSE range part is pushed down into a derived table, an enclosed outer reference can cause a null pointer crash. An example SELECT * FROM (SELECT id FROM t1 GROUP BY id) dt1, (SELECT id FROM t2) dt2, t3 WHERE dt2.id = t3.id AND dt1.id BETWEEN 0 AND (dt2.id IS NULL); is considered as one that can be pushed into the derived table dt1 because the expression (dt2.id IS NULL) is identified as always false. On the on other hand the condition still contains a reference to a column of the table dt2. When pushing the condition to the where clause of the derived table dt1 a copy of it is created and this copy is transformed to be used in the new where clause. When the transformation procedure encounters a reference dt2.id it crashes the server as only the references to the columns used in the group by list of the specification of dt1 or those equal to them are expected in the condition that can be pushed into the where clause of the derived table. Based on patch by Igor Babaev.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…o derived
When a condition containing an always FALSE range part is pushed down into a derived table, an enclosed outer reference can cause a null pointer crash. An example
SELECT * FROM (SELECT id FROM t1 GROUP BY id) dt1, (SELECT id FROM t2) dt2, t3
WHERE dt2.id = t3.id AND dt1.id BETWEEN 0 AND (dt2.id IS NULL);
is considered as one that can be pushed into the derived table dt1 because the expression (dt2.id IS NULL) is identified as always false. On the on other hand the condition still contains a reference to a column of the table dt2. When pushing the condition to the where clause of the derived table dt1 a copy of it is created and this copy is transformed to be used in the new where clause. When the transformation procedure encounters a reference dt2.id it crashes the server as only the references to the columns used in the group by list of the specification of dt1 or those equal to them are expected in the condition that can be pushed into the where clause of the derived table.
Based on patch by Igor Babaev.