1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

A fix and a test case for Bug#56540 "Exception (crash) in

sql_show.cc during rqg_info_schema test on Windows".

Ensure we do not access freed memory when filling
information_schema.views when one of the views
could not be properly opened.



mysql-test/r/information_schema.result:
  Update results - a fix for Bug#56540.
mysql-test/t/information_schema.test:
  Add a test case for Bug#56540
sql/sql_base.cc:
  Push an error into the Diagnostics area
  when we return an error.
  This directs get_all_tables() to the execution
  branch which doesn't involve 'process_table()'
  when no table/view was opened.
sql/sql_show.cc:
  Do not try to access underlying table fields
  when opening of a view failed. The underlying
  table is closed in that case, and accessing
  its fields may lead to dereferencing a damaged 
  pointer.
This commit is contained in:
Konstantin Osipov
2010-10-14 20:56:56 +04:00
parent 5a57a45c66
commit 248625d910
4 changed files with 124 additions and 8 deletions

View File

@ -2902,8 +2902,12 @@ retry_share:
*/
if (check_and_update_table_version(thd, table_list, share))
goto err_unlock;
if (table_list->i_s_requested_object & OPEN_TABLE_ONLY)
if (table_list->i_s_requested_object & OPEN_TABLE_ONLY)
{
my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db,
table_list->table_name);
goto err_unlock;
}
/* Open view */
if (open_new_frm(thd, share, alias,
@ -2931,7 +2935,11 @@ retry_share:
*/
if (table_list->i_s_requested_object & OPEN_VIEW_ONLY)
{
my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db,
table_list->table_name);
goto err_unlock;
}
if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
{