List:Commits« Previous MessageNext Message »
From:gluh Date:April 25 2006 10:02am
Subject:bk commit into 5.0 tree (gluh:1.2099) BUG#18177
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gluh. When gluh 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
  1.2099 06/04/25 15:02:37 gluh@stripped +3 -0
  Fix for bug#18177 any access to INFORMATION_SCHEMA.ROUTINES crashes
   replaced get_field(MEM_ROOT *mem, Field *field) with 
   get_field(MEM_ROOT *mem, Field *field, String *res).
   It allows to avoid strlen().

  sql/sql_show.cc
    1.316 06/04/25 15:02:31 gluh@stripped +12 -11
    Fix for bug#18177 any access to INFORMATION_SCHEMA.ROUTINES crashes
     replaced get_field(MEM_ROOT *mem, Field *field) with 
     get_field(MEM_ROOT *mem, Field *field, String *res).
     It allows to avoid strlen().

  mysql-test/t/information_schema.test
    1.72 06/04/25 15:02:31 gluh@stripped +12 -0
    Fix for bug#18177 any access to INFORMATION_SCHEMA.ROUTINES crashes
     test case

  mysql-test/r/information_schema.result
    1.101 06/04/25 15:02:31 gluh@stripped +11 -0
    Fix for bug#18177 any access to INFORMATION_SCHEMA.ROUTINES crashes
     test case

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Bugs/5.0.17204

--- 1.315/sql/sql_show.cc	Tue Apr 25 13:14:43 2006
+++ 1.316/sql/sql_show.cc	Tue Apr 25 15:02:31 2006
@@ -2844,17 +2844,18 @@ bool store_schema_proc(THD *thd, TABLE *
                        const char *wild, bool full_access, const char *sp_user)
 {
   String tmp_string;
+  String sp_db, sp_name, definer;
   TIME time;
   LEX *lex= thd->lex;
   CHARSET_INFO *cs= system_charset_info;
-  const char *sp_db, *sp_name, *definer;
-  sp_db= get_field(thd->mem_root, proc_table->field[0]);
-  sp_name= get_field(thd->mem_root, proc_table->field[1]);
-  definer= get_field(thd->mem_root, proc_table->field[11]);
+  get_field(thd->mem_root, proc_table->field[0], &sp_db);
+  get_field(thd->mem_root, proc_table->field[1], &sp_name);
+  get_field(thd->mem_root, proc_table->field[11], &definer);
   if (!full_access)
-    full_access= !strcmp(sp_user, definer);
-  if (!full_access && check_some_routine_access(thd, sp_db, sp_name,
-			proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE))
+    full_access= !strcmp(sp_user, definer.ptr());
+  if (!full_access && check_some_routine_access(thd, sp_db.ptr(), sp_name.ptr(),
+                                                proc_table->field[2]->val_int() ==
+                                                TYPE_ENUM_PROCEDURE))
     return 0;
 
   if (lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC &&
@@ -2864,13 +2865,13 @@ bool store_schema_proc(THD *thd, TABLE *
       lex->orig_sql_command == SQLCOM_END)
   {
     restore_record(table, s->default_values);
-    if (!wild || !wild[0] || !wild_compare(sp_name, wild, 0))
+    if (!wild || !wild[0] || !wild_compare(sp_name.ptr(), wild, 0))
     {
       int enum_idx= proc_table->field[5]->val_int();
-      table->field[3]->store(sp_name, strlen(sp_name), cs);
+      table->field[3]->store(sp_name.ptr(), sp_name.length(), cs);
       get_field(thd->mem_root, proc_table->field[3], &tmp_string);
       table->field[0]->store(tmp_string.ptr(), tmp_string.length(), cs);
-      table->field[2]->store(sp_db, strlen(sp_db), cs);
+      table->field[2]->store(sp_db.ptr(), sp_db.length(), cs);
       get_field(thd->mem_root, proc_table->field[2], &tmp_string);
       table->field[4]->store(tmp_string.ptr(), tmp_string.length(), cs);
       if (proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION)
@@ -2902,7 +2903,7 @@ bool store_schema_proc(THD *thd, TABLE *
       table->field[17]->store(tmp_string.ptr(), tmp_string.length(), cs);
       get_field(thd->mem_root, proc_table->field[15], &tmp_string);
       table->field[18]->store(tmp_string.ptr(), tmp_string.length(), cs);
-      table->field[19]->store(definer, strlen(definer), cs);
+      table->field[19]->store(definer.ptr(), definer.length(), cs);
       return schema_table_store_record(thd, table);
     }
   }

--- 1.100/mysql-test/r/information_schema.result	Tue Apr 25 13:14:43 2006
+++ 1.101/mysql-test/r/information_schema.result	Tue Apr 25 15:02:31 2006
@@ -1112,3 +1112,14 @@ CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET
 1	3
 9	27
 drop table t1;
+use mysql;
+INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL'
+,'NO','DEFINER','','','BEGIN\r\n  \r\nEND','root@%','2006-03-02 18:40:03',
+'2006-03-02 18:40:03','','');
+select routine_name from information_schema.routines;
+routine_name
+
+delete from proc where name='';
+select routine_name from information_schema.routines;
+routine_name
+use test;

--- 1.71/mysql-test/t/information_schema.test	Tue Apr 25 13:14:43 2006
+++ 1.72/mysql-test/t/information_schema.test	Tue Apr 25 15:02:31 2006
@@ -823,3 +823,15 @@ default character set utf8;
 select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
 information_schema.columns where table_schema='test' and table_name = 't1';
 drop table t1;
+
+#
+# Bug#18177 any access to INFORMATION_SCHEMA.ROUTINES crashes
+#
+use mysql;
+INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL'
+,'NO','DEFINER','','','BEGIN\r\n  \r\nEND','root@%','2006-03-02 18:40:03',
+'2006-03-02 18:40:03','','');
+select routine_name from information_schema.routines;
+delete from proc where name='';
+select routine_name from information_schema.routines;
+use test;
Thread
bk commit into 5.0 tree (gluh:1.2099) BUG#18177gluh25 Apr