diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-06-12 14:12:36 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-06-12 14:12:36 +0400 |
commit | ae0aefb1c522455b785c2e43636c482cd161e3de (patch) | |
tree | a25c8fd0172b5aaa3c18fc2355704d5c6d343cbf | |
parent | 8f5f0575ab41bd03369ab1dc31425ef7ab1c6b10 (diff) | |
download | mariadb-git-ae0aefb1c522455b785c2e43636c482cd161e3de.tar.gz |
MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command
This problem was earlier fixed by MDEV-14603.
Only adding 10.2 specific tests.
-rw-r--r-- | mysql-test/r/ps.result | 39 | ||||
-rw-r--r-- | mysql-test/t/ps.test | 56 |
2 files changed, 89 insertions, 6 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 6f86b330251..ac96dd05a2a 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -4918,9 +4918,6 @@ DROP TABLE t1; # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions # # -# End of 10.2 tests -# -# # MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter # CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL); @@ -5174,3 +5171,39 @@ execute stmt; execute stmt; execute stmt; drop table t1; +# +# MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command +# +CREATE ROLE testrole; +CREATE OR REPLACE PROCEDURE p1() +BEGIN +END; +/ +CREATE PROCEDURE p2 (wgrp VARCHAR(10)) +BEGIN +EXECUTE IMMEDIATE concat('GRANT EXECUTE ON PROCEDURE p1 TO ',wgrp); +END; +/ +CALL p2('testrole'); +DROP PROCEDURE p2; +CREATE PROCEDURE p2 () +BEGIN +EXECUTE IMMEDIATE concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1'testrole'); +END; +/ +CALL p2(); +DROP PROCEDURE p2; +CREATE PROCEDURE p2 () +BEGIN +PREPARE stmt FROM concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1' testrole'); +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +END; +/ +CALL p2(); +DROP PROCEDURE p2; +DROP PROCEDURE p1; +DROP ROLE testrole; +# +# End of 10.2 tests +# diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index e051cdce179..1c8595936cd 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -4386,9 +4386,6 @@ DROP TABLE t1; --echo # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions --echo # ---echo # ---echo # End of 10.2 tests ---echo # --echo # @@ -4650,3 +4647,56 @@ execute stmt; execute stmt; execute stmt; drop table t1; + + +--echo # +--echo # MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command +--echo # + +CREATE ROLE testrole; +DELIMITER /; +CREATE OR REPLACE PROCEDURE p1() +BEGIN +END; +/ +DELIMITER ;/ + +DELIMITER /; +CREATE PROCEDURE p2 (wgrp VARCHAR(10)) +BEGIN + EXECUTE IMMEDIATE concat('GRANT EXECUTE ON PROCEDURE p1 TO ',wgrp); +END; +/ +DELIMITER ;/ +CALL p2('testrole'); +DROP PROCEDURE p2; + +DELIMITER /; +CREATE PROCEDURE p2 () +BEGIN + EXECUTE IMMEDIATE concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1'testrole'); +END; +/ +DELIMITER ;/ +CALL p2(); +DROP PROCEDURE p2; + +DELIMITER /; +CREATE PROCEDURE p2 () +BEGIN + PREPARE stmt FROM concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1' testrole'); + EXECUTE stmt; + DEALLOCATE PREPARE stmt; +END; +/ +DELIMITER ;/ +CALL p2(); +DROP PROCEDURE p2; + +DROP PROCEDURE p1; +DROP ROLE testrole; + + +--echo # +--echo # End of 10.2 tests +--echo # |