summaryrefslogtreecommitdiff
path: root/mysql-test/r/lock_sync.result
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@oracle.com>2010-11-03 16:47:32 +0100
committerJon Olav Hauglid <jon.hauglid@oracle.com>2010-11-03 16:47:32 +0100
commitc1b2d729002fa28bf29957436c0ed1926e9c45a6 (patch)
treedc131d4aa1fcc4e9194a1c39b1b6491ecb2fb3eb /mysql-test/r/lock_sync.result
parent3e593c7436c8764d9c7054cf50cbf4fbb7d74bfd (diff)
downloadmariadb-git-c1b2d729002fa28bf29957436c0ed1926e9c45a6.tar.gz
Bug #57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW
This crash could happen if SHOW CREATE VIEW indirectly failed to open a view due to failures to open underlying tables (or functions). Several such errors were hidden and converted to ER_VIEW_INVALID warnings to prevent exposing details of underlying tables for which the user have no privileges. However, with the changes introduced by the patch for Bug#52044, failing to open a view will cause opened tables, views and functions to be closed. Since the errors causing these failures were converted to warnings, SHOW CREATE VIEW would try to continue. This made it possible to try to access memory that had been freed, causing a crash. This patch fixes the problem by not closing opened tables, views and functions in these cases. This allows SHOW CREATE VIEW to continue and also prevents it from accessing freed memory. Test case added to lock_sync.test.
Diffstat (limited to 'mysql-test/r/lock_sync.result')
-rw-r--r--mysql-test/r/lock_sync.result35
1 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/r/lock_sync.result b/mysql-test/r/lock_sync.result
index 726b754eaa8..8fe94679e70 100644
--- a/mysql-test/r/lock_sync.result
+++ b/mysql-test/r/lock_sync.result
@@ -738,3 +738,38 @@ SET DEBUG_SYNC= 'now SIGNAL release_thrlock';
# Connection default
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
+#
+# Bug#57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW
+#
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+DROP FUNCTION IF EXISTS f1;
+CREATE TABLE t1(a INT);
+CREATE FUNCTION f1() RETURNS INTEGER RETURN 1;
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE f1() = 1;
+DROP FUNCTION f1;
+# Connection con1
+SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped EXECUTE 2';
+# Sending:
+SHOW CREATE VIEW v1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+SET DEBUG_SYNC= 'now SIGNAL dropped';
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+# Sending:
+FLUSH TABLES;
+# Connection default
+# Waiting for FLUSH TABLES to be blocked.
+SET DEBUG_SYNC= 'now SIGNAL dropped';
+# Connection con1
+# Reaping: SHOW CREATE VIEW v1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`f1`() = 1) latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+# Connection con2
+# Reaping: FLUSH TABLES
+# Connection default
+SET DEBUG_SYNC= 'RESET';
+DROP VIEW v1;
+DROP TABLE t1;