summaryrefslogtreecommitdiff
path: root/sql/sql_lex.h
diff options
context:
space:
mode:
authordavi@mysql.com/endora.local <>2008-02-20 17:26:50 -0300
committerdavi@mysql.com/endora.local <>2008-02-20 17:26:50 -0300
commitb9c6b9eced97457a4682201c6ba779b3728b5f4b (patch)
tree86791834ed343f7df7fb49acd750f99ea3e9821f /sql/sql_lex.h
parent6bf1306b137a7166bb8b3f8e76e3813eb2bc7891 (diff)
downloadmariadb-git-b9c6b9eced97457a4682201c6ba779b3728b5f4b.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.
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r--sql/sql_lex.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index ef0a9bb11ef..744019c8ae9 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1513,10 +1513,8 @@ typedef struct st_lex : public Query_tables_list
/* store original leaf_tables for INSERT SELECT and PS/SP */
TABLE_LIST *leaf_tables_insert;
- /** Start of SELECT of CREATE VIEW statement */
- const char* create_view_select_start;
- /** End of SELECT of CREATE VIEW statement */
- const char* create_view_select_end;
+ /** SELECT of CREATE VIEW statement */
+ LEX_STRING create_view_select;
/** Start of 'ON table', in trigger statements. */
const char* raw_trg_on_table_name_begin;