• davi@mysql.com/endora.local's avatar
    Bug#34587 Creating a view inside a stored procedure leads to a server crash · b9c6b9ec
    davi@mysql.com/endora.local authored
    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. 
    b9c6b9ec
sql_yacc.yy 374 KB