From 2a5a3de285e5ea200c1aaf8d90094aa52422f644 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 May 2005 17:47:08 +0200 Subject: [PATCH] Fixed BUG#10537: Server crashes while loading data file into table through procedure. by simply disabling 'load' in stored procedures, like it's already disabled for prepared statements. (They must be made "re-execution" safe before working with either PS or SP.) mysql-test/r/sp-error.result: New test case for BUG#10537. mysql-test/t/sp-error.test: New test case for BUG#10537. sql/sql_yacc.yy: Disable LOAD in stored procedures (just as for prepared statements). --- mysql-test/r/sp-error.result | 4 ++++ mysql-test/t/sp-error.test | 12 ++++++++++++ sql/sql_yacc.yy | 13 ++++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 683f3e12091..7c19f60471a 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -642,4 +642,8 @@ val x bug8408() 7 7 3 drop function bug8408| delete from t1| +drop procedure if exists bug10537| +create procedure bug10537() +load data local infile '/tmp/somefile' into table t1| +ERROR 0A000: LOAD DATA is not allowed in stored procedures drop table t1| diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index ff317b4ac28..67e9be5dd5d 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -893,6 +893,18 @@ drop function bug8408| delete from t1| +# +# BUG#10537: Server crashes while loading data file into table through +# procedure. +# Disable load until it's PS and SP safe +--disable_warnings +drop procedure if exists bug10537| +--enable_warnings +--error ER_SP_BADSTATEMENT +create procedure bug10537() + load data local infile '/tmp/somefile' into table t1| + + # # BUG#NNNN: New bug synopsis # diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f4af0dd1ded..99b0f43db2d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -6611,6 +6611,11 @@ use: USE_SYM ident load: LOAD DATA_SYM { LEX *lex=Lex; + if (lex->sphead) + { + my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD DATA"); + YYABORT; + } lex->fname_start= lex->ptr; } load_data @@ -6618,7 +6623,13 @@ load: LOAD DATA_SYM | LOAD TABLE_SYM table_ident FROM MASTER_SYM { - Lex->sql_command = SQLCOM_LOAD_MASTER_TABLE; + LEX *lex=Lex; + if (lex->sphead) + { + my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD TABLE"); + YYABORT; + } + lex->sql_command = SQLCOM_LOAD_MASTER_TABLE; if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING)) YYABORT; };