mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user