diff options
author | Kristofer Pettersson <kpettersson@mysql.com> | 2008-08-11 11:40:54 +0200 |
---|---|---|
committer | Kristofer Pettersson <kpettersson@mysql.com> | 2008-08-11 11:40:54 +0200 |
commit | 75a5ecbd7292e70a14b0fd44d75540937ed31487 (patch) | |
tree | 89512c065da9a263fa235b749bf53e95ba490c00 /tests | |
parent | 0a415f62fdf4c0698a04b97b3b3208455bf9c834 (diff) | |
download | mariadb-git-75a5ecbd7292e70a14b0fd44d75540937ed31487.tar.gz |
Bug#38486 Crash when using cursor protocol
Server side cursors were not initialized properly and this caused a reference to
uninitialized memory.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 5e1c2afe84a..4336bfa0c59 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -16189,6 +16189,35 @@ static void test_bug32265() DBUG_VOID_RETURN; } + +/** + Bug#38486 Crash when using cursor protocol +*/ + +static void test_bug38486(void) +{ + myheader("test_bug38486"); + + MYSQL_STMT *stmt; + stmt= mysql_stmt_init(mysql); + unsigned long type= CURSOR_TYPE_READ_ONLY; + mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type); + const char *sql= "CREATE TABLE t1 (a INT)"; + mysql_stmt_prepare(stmt,sql,strlen(sql)); + + mysql_stmt_execute(stmt); + mysql_stmt_close(stmt); + + stmt= mysql_stmt_init(mysql); + mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type); + const char *sql2= "INSERT INTO t1 VALUES (1)"; + mysql_stmt_prepare(stmt,sql2,strlen(sql2)); + mysql_stmt_execute(stmt); + + mysql_stmt_close(stmt); +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -16483,6 +16512,7 @@ static struct my_tests_st my_tests[]= { { "test_bug29306", test_bug29306 }, { "test_bug31669", test_bug31669 }, { "test_bug32265", test_bug32265 }, + { "test_bug38486", test_bug38486 }, { 0, 0 } }; |