1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

Fixed for MDEV-26761:

If mariadb_stmt_execute_direct fails, we need to set the number
of parameters (obtained by response packet of mysql_stmt_prepare)
back to the number of prebinded parameters to avoid memory
overrun.

This fix also includes several adress-sanitizer bugs in unit tests
of Connector/C.
This commit is contained in:
Georg Richter
2021-10-05 14:50:32 +02:00
parent 410d64d8de
commit 9c02505474
6 changed files with 158 additions and 7 deletions

View File

@@ -1060,7 +1060,7 @@ static int test_read_timeout(MYSQL *unused __attribute__((unused)))
return OK;
}
#if __has_feature(memory_sanitizer)
#ifdef HAVE_REMOTEIO
void *remote_plugin;
static int test_remote1(MYSQL *mysql)
@@ -1126,6 +1126,7 @@ static int test_remote2(MYSQL *my)
return OK;
}
#endif
#endif
#ifndef _WIN32
static int test_mdev12965(MYSQL *unused __attribute__((unused)))
@@ -1494,6 +1495,7 @@ static int test_sslenforce(MYSQL *unused __attribute__((unused)))
}
#endif
#if !__has_feature(memory_sanitizer)
static int test_conc457(MYSQL *mysql)
{
MYSQL_RES *result;
@@ -1506,6 +1508,7 @@ static int test_conc457(MYSQL *mysql)
mysql_free_result(result);
return OK;
}
#endif
static int test_conc458(MYSQL *my __attribute__((unused)))
{
@@ -1518,7 +1521,9 @@ static int test_conc458(MYSQL *my __attribute__((unused)))
struct my_tests_st my_tests[] = {
{"test_conc458", test_conc458, TEST_CONNECTION_NONE, 0, NULL, NULL},
#if !__has_feature(memory_sanitizer)
{"test_conc457", test_conc457, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
#endif
{"test_conc384", test_conc384, TEST_CONNECTION_NONE, 0, NULL, NULL},
#ifndef _WIN32
{"test_mdev12965", test_mdev12965, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
@@ -1529,9 +1534,11 @@ struct my_tests_st my_tests[] = {
{"test_server_status", test_server_status, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_read_timeout", test_read_timeout, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_zerofill", test_zerofill, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
#if !__has_feature(memory_sanitizer)
#ifdef HAVE_REMOTEIO
{"test_remote1", test_remote1, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_remote2", test_remote2, TEST_CONNECTION_NEW, 0, NULL, NULL},
#endif
#endif
{"test_get_info", test_get_info, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc117", test_conc117, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},