summaryrefslogtreecommitdiff
path: root/sql/sp.cc
diff options
context:
space:
mode:
authorpem@mysql.comhem.se <>2004-03-17 12:09:03 +0100
committerpem@mysql.comhem.se <>2004-03-17 12:09:03 +0100
commit0411f4580184d20d907fc6e0e18794bc3fdc4624 (patch)
treec789edeeadcae70a23117ca6cb30daf503df4347 /sql/sp.cc
parent1631ba625f9db24372b1f02b73fa0d5ffcab85fd (diff)
downloadmariadb-git-0411f4580184d20d907fc6e0e18794bc3fdc4624.tar.gz
Fix BUG#2674: Crash if return system variable in stored procedures.
Had to initialize some fields in lex before parsing an SP read from mysql.proc.
Diffstat (limited to 'sql/sp.cc')
-rw-r--r--sql/sp.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index 83fbd8c5173..f517504e1f5 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -230,7 +230,20 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
goto done;
}
- lex_start(thd, (uchar*)defstr, deflen);
+ {
+ /* This is something of a kludge. We need to initialize some fields
+ * in thd->lex (the unit and master stuff), and the easiest way to
+ * do it is, is to call mysql_init_query(), but this unfortunately
+ * resets teh value_list where we keep the CALL parameters. So we
+ * copy the list and then restore it.
+ */
+ List<Item> vals= thd->lex->value_list;
+
+ mysql_init_query(thd, TRUE);
+ lex_start(thd, (uchar*)defstr, deflen);
+ thd->lex->value_list= vals;
+ }
+
if (yyparse(thd) || thd->is_fatal_error || thd->lex->sphead == NULL)
{
LEX *newlex= thd->lex;