diff options
author | unknown <davi@mysql.com/endora.local> | 2008-02-20 17:26:50 -0300 |
---|---|---|
committer | unknown <davi@mysql.com/endora.local> | 2008-02-20 17:26:50 -0300 |
commit | 7114fbb943514e030c7554273b266adb923b035a (patch) | |
tree | 86791834ed343f7df7fb49acd750f99ea3e9821f /mysql-test/r/view.result | |
parent | 5704c7fe2cf52fb8bec0f8e8006f7a4b181e1660 (diff) | |
download | mariadb-git-7114fbb943514e030c7554273b266adb923b035a.tar.gz |
Bug#34587 Creating a view inside a stored procedure leads to a server crash
The problem is that when a stored procedure is being parsed for
the first execution, the body is copied to a temporary buffer
which is disregarded sometime after the statement is parsed.
And during this parsing phase, the rule for CREATE VIEW was
holding a reference to the string being parsed for use during
the execution of the CREATE VIEW statement, leading to invalid
memory access later.
The solution is to allocate and copy the SELECT of a CREATE
VIEW statement using the thread memory root, which is set to
the permanent arena of the stored procedure.
mysql-test/r/view.result:
Add test case result for Bug#34587
mysql-test/t/view.test:
Add test case for Bug#34587
sql/sql_lex.h:
Remove start and end position variables. The SELECT of a
CREATE VIEW is now allocated at parse time.
sql/sql_view.cc:
Remove assertion that is not true when the statement is
being re-executed. Use string that was trimmed of leading
and trailing whitespace at parse time.
sql/sql_yacc.yy:
Allocate the SELECT of a CREATE VIEW using the current thread
memory root and remove any leading and trailing whitespace.
Diffstat (limited to 'mysql-test/r/view.result')
-rw-r--r-- | mysql-test/r/view.result | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 3f8ed1b4e56..c5557114e0c 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3720,6 +3720,16 @@ DROP VIEW v1; # -- End of test case for Bug#32538. +drop view if exists a; +drop procedure if exists p; +create procedure p() +begin +declare continue handler for sqlexception begin end; +create view a as select 1; +end| +call p(); +call p(); +drop procedure p; # ----------------------------------------------------------------- # -- End of 5.1 tests. # ----------------------------------------------------------------- |