summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2021-03-03 22:48:39 -0800
committerIgor Babaev <igor@askmonty.org>2021-03-03 22:49:29 -0800
commit08d8bce583227a25b4f646fa9a836f7893badd9a (patch)
tree9cc6227d699b7ae4e267085663f30bd4b6d4e318 /sql/sql_yacc.yy
parent5bd994b0d56d11bf62717a84172c49ca9ed37de4 (diff)
downloadmariadb-git-08d8bce583227a25b4f646fa9a836f7893badd9a.tar.gz
MDEV-22786 Crashes with nested table value constructors
The bug caused crashes of the server when processing queries with nested table value constructors (TVC) . It happened because the grammar rules to parse TVC used the same global lists for both nested TVC and nesting TVC. As a result invalid select trees were constructed for queries with nested TVC and this led to crashes at the prepare stage. This patch provides its own lists structures for each TVC nest level. Besides the patch fixes a bug in the function wrap_tvc() that missed inheritance of the SELECT_LEX::exclude_from_table_unique_test for selects that wrapped TVCs. This inheritance is critical for specifications of derived tables that employ nested TVCs. Approved by dmitry.shulga@mariadb.com
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 88f12e97bfa..b26e2ddbf1b 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -12334,7 +12334,8 @@ derived_query_specification:
derived_table_value_constructor:
VALUES
{
- Lex->tvc_start();
+ if (Lex->tvc_start_derived())
+ MYSQL_YYABORT;
}
values_list
{