List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:June 7 2007 3:35pm
Subject:bk commit into 5.0 tree (anozdrin:1.2516) BUG#27592
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of alik. When alik 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-06-07 19:35:29+04:00, anozdrin@ibm. +1 -0
  Add test case for BUG#27592: stack overrun when storing datetime
  value using prepared statements.

  tests/mysql_client_test.c@stripped, 2007-06-07 19:35:26+04:00, anozdrin@ibm. +54 -0
    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:	anozdrin
# Host:	ibm.
# Root:	/home/alik/Documents/MySQL/devel/5.0-rt-bug275920-2

--- 1.227/tests/mysql_client_test.c	2007-05-26 00:35:58 +04:00
+++ 1.228/tests/mysql_client_test.c	2007-06-07 19:35:26 +04:00
@@ -15624,6 +15624,59 @@
 
 
 /*
+  Bug#27592 (stack overrun when storing datetime value using prepared statements)
+*/
+
+static void test_bug27592()
+{
+  const int NUM_ITERATIONS= 40;
+  int i;
+  int rc;
+  MYSQL_STMT *stmt= NULL;
+  MYSQL_BIND bind[1];
+  MYSQL_TIME time_val;
+
+  DBUG_ENTER("test_bug27592");
+  myheader("test_bug27592");
+
+  mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+  mysql_query(mysql, "CREATE TABLE t1(c2 DATETIME)");
+
+  stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 VALUES (?)");
+  DIE_UNLESS(stmt);
+
+  memset(bind, 0, sizeof(bind));
+
+  bind[0].buffer_type= MYSQL_TYPE_DATETIME;
+  bind[0].buffer= (char *) &time_val;
+  bind[0].length= NULL;
+
+  for (i= 0; i < NUM_ITERATIONS; i++)
+  {
+    time_val.year=1000+lrand48()%1000;
+    time_val.month=1+lrand48()%12;
+    time_val.day=1+lrand48()%31;
+    time_val.hour=lrand48()%23;
+    time_val.minute=lrand48()%59;
+    time_val.second=lrand48()%59;
+
+    time_val.second_part=0;
+    time_val.neg=0;
+
+    rc= mysql_stmt_bind_param(stmt, bind);
+    check_execute(stmt, rc);
+
+    rc= mysql_stmt_execute(stmt);
+    check_execute(stmt, rc);
+  }
+
+  mysql_stmt_close(stmt);
+
+  DBUG_VOID_RETURN;
+}
+
+
+/*
   Read and parse arguments and MySQL options from my.cnf
 */
 
@@ -15904,6 +15957,7 @@
   { "test_bug21635", test_bug21635 },
   { "test_bug24179", test_bug24179 },
   { "test_bug27876", test_bug27876 },
+  { "test_bug27592", test_bug27592 },
   { 0, 0 }
 };
 
Thread
bk commit into 5.0 tree (anozdrin:1.2516) BUG#27592Alexander Nozdrin7 Jun