Bug #26940 CREATE SERVER does not initialize record[0] in insert_server_record()
Submitted: 7 Mar 2007 23:42 Modified: 8 Mar 2007 21:17
Reporter: Timothy Smith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S7 (Test Cases)
Version: OS:
Assigned to: Magnus BlÄudd CPU Architecture:Any

[7 Mar 2007 23:42] Timothy Smith
Description:
Quote from Magnus:

--------------------------
while working with unifying the sources for our system tables(they are all defined in scripts/mysql_system_tables.sql now) I found that we inserted a "test" server in mysql.server, since we don't really want to have any test data in the official MySQL system tables I removed that and it reveals that CREATE SERVER does not properly initialize record[0] before inserting the record

Using 'empty_record' in that function would fix it.

--- 1.5/sql/sql_servers.cc      2007-01-29 00:47:31 +01:00
+++ edited/sql_servers.cc       2007-03-05 16:42:27 +01:00
@@ -545,6 +545,8 @@ int insert_server_record(TABLE *table, F
   DBUG_ENTER("insert_server_record");
   table->use_all_columns();

+  empty_record(table);
+
   /* set the field that's the PK to the value we're looking for */
   table->field[0]->store(server->server_name,
                          server->server_name_length,

What do you say about that?

At first it looked like this only occurred on Solaris and Windows but it can actually be reproduced on a normal linux machine if removing the code that initializes memory to 0xA5. A little funny that our code to find bugs actually masks it.
--------------------------

Timothy added the bogus row into the mysql.servers table as a stop-gap measure until this patch can be approved.

Please remove that from scripts/msyql_system_tables_data.sql once this is approved.

How to repeat:
See, for example: https://intranet.mysql.com/~knielsen/pb/getlog.pl?dir=mysql-5.1-new-maint&entry=tsmith@qua...

Suggested fix:
See description.
[8 Mar 2007 1:00] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/21440

ChangeSet@1.2460, 2007-03-08 02:00:21+01:00, tsmith@quadxeon.mysql.com +1 -0
  Bug #26940: CREATE SERVER does not initialize record[0] in insert_server_record()
  
  sql_servers.cc:insert_server_record():  initialize record[0] before inserting row
[8 Mar 2007 21:17] Paul DuBois
No changelog entry needed.