MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:ramil Date:May 14 2007 10:06am
Subject:bk commit into 5.1 tree (ramil:1.2486) BUG#23810
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of ram. When ram 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, 2007-05-14 15:06:25+05:00, ramil@stripped +2 -0
  Fix for bug #23810: Server crashes on various "show status ..." commands
    
  We access some variable values using casts like *(long *) buff
  that may cause crashes on some platforms (e.g. solaris 64) if buff is
  not properly aligned.
  Fix: align the buffer used.

  include/my_global.h@stripped, 2007-05-14 15:06:23+05:00, ramil@stripped +2 -0
    Fix for bug #23810: Server crashes on various "show status ..." commands
      - MY_DIV_UP(A, B) macro introduced, which devides A then rounds up by B.

  sql/sql_show.cc@stripped, 2007-05-14 15:06:24+05:00, ramil@stripped +5 -2
    Fix for bug #23810: Server crashes on various "show status ..." commands
      - align the buffer used.

# 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:	ramil
# Host:	ramil.myoffice.izhnet.ru
# Root:	/home/ram/work/b23810/b23810.5.1

--- 1.408/sql/sql_show.cc	2007-05-14 15:06:31 +05:00
+++ 1.409/sql/sql_show.cc	2007-05-14 15:06:31 +05:00
@@ -2022,7 +2022,9 @@ static bool show_status_array(THD *thd, 
                               const char *prefix, TABLE *table,
                               bool ucase_names)
 {
-  char buff[SHOW_VAR_FUNC_BUFF_SIZE], *prefix_end;
+  long buff_data[MY_DIV_UP(SHOW_VAR_FUNC_BUFF_SIZE, sizeof(long))];
+  char * const buff= (char *) &buff_data;
+  char *prefix_end;
   /* the variable name should not be longer than 64 characters */
   char name_buffer[64];
   int len;
@@ -5216,7 +5218,8 @@ int fill_schema_status(THD *thd, SHOW_VA
   SHOW_VAR tmp, *var;
   SHOW_TYPE show_type;
   LEX_STRING null_lex_str;
-  char buff[SHOW_VAR_FUNC_BUFF_SIZE];
+  long buff_data[MY_DIV_UP(SHOW_VAR_FUNC_BUFF_SIZE, sizeof(long))];
+  char * const buff= (char *) &buff_data;
   char name_buf[64], *name_pos;
   int name_len;
   DBUG_ENTER("fill_schema_status");

--- 1.168/include/my_global.h	2007-05-14 15:06:31 +05:00
+++ 1.169/include/my_global.h	2007-05-14 15:06:31 +05:00
@@ -899,6 +899,8 @@ typedef unsigned long long my_size_t;
 #define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size)
 #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B))
 
+#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B))
+
 /*
   Custom version of standard offsetof() macro which can be used to get
   offsets of members in class for non-POD types (according to the current
Thread
bk commit into 5.1 tree (ramil:1.2486) BUG#23810ramil14 May