List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:February 15 2008 9:01am
Subject:bk commit into 5.1 tree (anozdrin:1.2552) BUG#34337
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of anozdrin.  When anozdrin does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-02-15 12:01:11+03:00, anozdrin@quad. +3 -0
  Fix for Bug#34337: Server crash when Altering a view using
  a table name.
  
  The problem was that in some cases lex->definer->user and
  lex->definer->host are NULL, but they were still passed
  to strcmp-functions.
  
  The fix is to check for NULL before passing strings.

  mysql-test/r/view.result@stripped, 2008-02-15 12:01:10+03:00, anozdrin@quad. +15 -0
    Fix result file.

  mysql-test/t/view.test@stripped, 2008-02-15 12:01:10+03:00, anozdrin@quad. +28 -0
    Add a test case for Bug#34337: Server crash when Altering a view
    using a table name.

  sql/sql_view.cc@stripped, 2008-02-15 12:01:10+03:00, anozdrin@quad. +2 -0
    Check strings for NULL before comparing.

diff -Nrup a/mysql-test/r/view.result b/mysql-test/r/view.result
--- a/mysql-test/r/view.result	2008-02-12 22:09:14 +03:00
+++ b/mysql-test/r/view.result	2008-02-15 12:01:10 +03:00
@@ -3721,5 +3721,20 @@ DROP VIEW v1;
 # -- End of test case for Bug#32538.
 
 # -----------------------------------------------------------------
+# -- Bug#34337: Server crash when Altering a view using a table name.
+# -----------------------------------------------------------------
+
+DROP TABLE IF EXISTS t1;
+
+CREATE TABLE t1(c1 INT);
+
+ALTER ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW t1 (c2) AS SELECT (1);
+ERROR HY000: 'test.t1' is not VIEW
+
+DROP TABLE t1;
+
+# -- End of test case for Bug#34337.
+
+# -----------------------------------------------------------------
 # -- End of 5.1 tests.
 # -----------------------------------------------------------------
diff -Nrup a/mysql-test/t/view.test b/mysql-test/t/view.test
--- a/mysql-test/t/view.test	2008-02-12 22:09:14 +03:00
+++ b/mysql-test/t/view.test	2008-02-15 12:01:10 +03:00
@@ -3604,5 +3604,33 @@ DROP VIEW v1;
 ###########################################################################
 
 --echo # -----------------------------------------------------------------
+--echo # -- Bug#34337: Server crash when Altering a view using a table name.
+--echo # -----------------------------------------------------------------
+--echo
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo
+
+CREATE TABLE t1(c1 INT);
+
+--echo
+
+--error ER_WRONG_OBJECT
+ALTER ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW t1 (c2) AS SELECT (1);
+
+--echo
+
+DROP TABLE t1;
+
+--echo
+--echo # -- End of test case for Bug#34337.
+--echo
+
+###########################################################################
+
+--echo # -----------------------------------------------------------------
 --echo # -- End of 5.1 tests.
 --echo # -----------------------------------------------------------------
diff -Nrup a/sql/sql_view.cc b/sql/sql_view.cc
--- a/sql/sql_view.cc	2008-02-08 18:55:04 +03:00
+++ b/sql/sql_view.cc	2008-02-15 12:01:10 +03:00
@@ -278,6 +278,8 @@ bool mysql_create_view(THD *thd, TABLE_L
       - current user has SUPER_ACL
   */
   if (lex->definer &&
+      lex->definer->user.str &&
+      lex->definer->host.str &&
       (strcmp(lex->definer->user.str, thd->security_ctx->priv_user) != 0 ||
        my_strcasecmp(system_charset_info,
                      lex->definer->host.str,
Thread
bk commit into 5.1 tree (anozdrin:1.2552) BUG#34337Alexander Nozdrin15 Feb
  • Re: bk commit into 5.1 tree (anozdrin:1.2552) BUG#34337Konstantin Osipov15 Feb