summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <kroki/tomash@moonlight.intranet>2006-07-29 13:50:08 +0400
committerunknown <kroki/tomash@moonlight.intranet>2006-07-29 13:50:08 +0400
commit1d0f873d5665596505cddd7e74b34693b5241546 (patch)
tree3373d512679abd089a6fb09d9851a692c479063f
parent74214b8635c9373abe6ec8f9e7f5f990d13f9fe9 (diff)
downloadmariadb-git-1d0f873d5665596505cddd7e74b34693b5241546.tar.gz
Fix after manual merge.
tests/mysql_client_test.c: Fix after manual merge: add test for bug#21206.
-rw-r--r--mysys/my_bitmap.c2
-rw-r--r--tests/mysql_client_test.c44
2 files changed, 45 insertions, 1 deletions
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index 3a83372b637..25ff2651e90 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -445,7 +445,7 @@ uint bitmap_get_first(const MY_BITMAP *map)
{
uchar *bitmap=map->bitmap;
uint bit_found = MY_BIT_NONE;
- uint bitmap_size=map->bitmap_size*8;
+ uint bitmap_size=map->bitmap_size;
uint i;
DBUG_ASSERT(map->bitmap);
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 76a220e2454..5ee63cb8738 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -15029,6 +15029,49 @@ static void test_bug20152()
/*
+ Bug#21206: memory corruption when too many cursors are opened at once
+
+ Memory corruption happens when more than 1024 cursors are open
+ simultaneously.
+*/
+static void test_bug21206()
+{
+ const size_t cursor_count= 1025;
+
+ const char *create_table[]=
+ {
+ "DROP TABLE IF EXISTS t1",
+ "CREATE TABLE t1 (i INT)",
+ "INSERT INTO t1 VALUES (1), (2), (3)"
+ };
+ const char *query= "SELECT * FROM t1";
+
+ Stmt_fetch *fetch_array=
+ (Stmt_fetch*) calloc(cursor_count, sizeof(Stmt_fetch));
+
+ Stmt_fetch *fetch;
+
+ DBUG_ENTER("test_bug21206");
+ myheader("test_bug21206");
+
+ fill_tables(create_table, sizeof(create_table) / sizeof(*create_table));
+
+ for (fetch= fetch_array; fetch < fetch_array + cursor_count; ++fetch)
+ {
+ /* Init will exit(1) in case of error */
+ stmt_fetch_init(fetch, fetch - fetch_array, query);
+ }
+
+ for (fetch= fetch_array; fetch < fetch_array + cursor_count; ++fetch)
+ stmt_fetch_close(fetch);
+
+ free(fetch_array);
+
+ DBUG_VOID_RETURN;
+}
+
+
+/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -15300,6 +15343,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug14169", test_bug14169 },
{ "test_bug17667", test_bug17667 },
{ "test_bug19671", test_bug19671},
+ { "test_bug21206", test_bug21206},
{ 0, 0 }
};