summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-06-12 09:52:31 +0400
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-06-12 09:52:31 +0400
commit13a43a1aac3e098dd3a261dc944ff25c3f8d2437 (patch)
treec1512f011fef30078a4f2969d51610d8f57bf7c6 /sql/sql_prepare.cc
parent08f3b0ab92cdbd1e9723d810d481cb089c9bdeb9 (diff)
downloadmariadb-git-13a43a1aac3e098dd3a261dc944ff25c3f8d2437.tar.gz
Addendum for the fix for bug #42064:
In Prepared_statement::prepare() bail out as soon as parser_state.init() fails, trying to continue leads to crashes.
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 85ec5a72d77..a4241772311 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -3034,16 +3034,21 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
thd->stmt_arena= this;
Parser_state parser_state;
- if (!parser_state.init(thd, thd->query(), thd->query_length()))
+ if (parser_state.init(thd, thd->query(), thd->query_length()))
{
- parser_state.m_lip.stmt_prepare_mode= TRUE;
- lex_start(thd);
-
- error= parse_sql(thd, & parser_state, NULL) ||
- thd->is_error() ||
- init_param_array(this);
+ thd->restore_backup_statement(this, &stmt_backup);
+ thd->restore_active_arena(this, &stmt_backup);
+ thd->stmt_arena= old_stmt_arena;
+ DBUG_RETURN(TRUE);
}
+ parser_state.m_lip.stmt_prepare_mode= TRUE;
+ lex_start(thd);
+
+ error= parse_sql(thd, & parser_state, NULL) ||
+ thd->is_error() ||
+ init_param_array(this);
+
lex->set_trg_event_type_for_tables();
/*