List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:July 15 2011 12:26pm
Subject:bzr push into mysql-5.1 branch (alexander.nozdrin:3572 to 3573) Bug#59060
View as plain text  
 3573 Alexander Nozdrin	2011-07-15
      Backport a fix for Bug#59060 (Valgrind warning in Protocol_text::store()).
      
      Original changeset:
      revision-id: alexander.nozdrin@stripped
      parent: sven.sandberg@stripped
      committer: Alexander Nozdrin <alexander.nozdrin@stripped>
      branch nick: mysql-trunk-bugfixing
      timestamp: Tue 2010-12-21 15:23:49 +0300
      message:
        A patch for Bug#59060 (Valgrind warning in Protocol_text::store()).
        
        We should not assume to have zero-terminated strings.

    modified:
      sql/protocol.cc
 3572 Luis Soares	2011-07-15
      DBUG_PRINT in solaris does not work well with NULL parameters.
      HA_ERR was returning 0 (null string) when no error happened 
      (error=0). Since HA_ERR is used in DBUG_PRINT, regardless there 
      was an error or not, the server could crash in solaris debug
      builds.
      
      We fix this by:
      
        - deploying an assertion that ensures that the function 
          is not called when no error has happened;
        - making sure that HA_ERR is only called when an error 
          happened;
        - making HA_ERR return "No Error", instead of 0, for 
          non-debug builds if it is called when no error happened.
      
      This will make HA_ERR return values to work with DBUG_PRINT on
      solaris debug builds.

    modified:
      sql/log_event.cc
=== modified file 'sql/protocol.cc'
--- a/sql/protocol.cc	2011-06-30 15:37:13 +0000
+++ b/sql/protocol.cc	2011-07-15 12:25:00 +0000
@@ -857,8 +857,8 @@ bool Protocol_text::store(const char *fr
 {
   CHARSET_INFO *tocs= this->thd->variables.character_set_results;
 #ifndef DBUG_OFF
-  DBUG_PRINT("info", ("Protocol_text::store field %u (%u): %s", field_pos,
-                      field_count, (length == 0? "" : from)));
+  DBUG_PRINT("info", ("Protocol_text::store field %u (%u): %.*s", field_pos,
+                      field_count, (int) length, (length == 0 ? "" : from)));
   DBUG_ASSERT(field_pos < field_count);
   DBUG_ASSERT(field_types == 0 ||
 	      field_types[field_pos] == MYSQL_TYPE_DECIMAL ||

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1 branch (alexander.nozdrin:3572 to 3573) Bug#59060Alexander Nozdrin17 Jul