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

@@ -206,7 +206,7 @@ static int test_view_2where(MYSQL *mysql)
" AENAME,T0001.DEPENDVARS AS DEPENDVARS,T0001.INACTIVE AS "
" INACTIVE from LTDX T0001 where (T0001.SRTF2 = 0)");
check_mysql_rc(rc, mysql);
memset(my_bind, '\0', sizeof(MYSQL_BIND));
memset(my_bind, '\0', 8 * sizeof(MYSQL_BIND));
for (i=0; i < 8; i++) {
strcpy(params[i], "1");
my_bind[i].buffer_type = MYSQL_TYPE_VAR_STRING;
@@ -257,7 +257,7 @@ static int test_view_star(MYSQL *mysql)
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "CREATE VIEW vt1 AS SELECT a FROM t1");
check_mysql_rc(rc, mysql);
memset(my_bind, '\0', sizeof(MYSQL_BIND));
memset(my_bind, '\0', 8 * sizeof(MYSQL_BIND));
for (i= 0; i < 2; i++) {
sprintf((char *)&params[i], "%d", i);
my_bind[i].buffer_type = MYSQL_TYPE_VAR_STRING;
@@ -438,7 +438,7 @@ static int test_view_insert_fields(MYSQL *mysql)
memset(my_bind, '\0', sizeof(my_bind));
for (i= 0; i < 11; i++)
{
l[i]= 20;
l[i]= 2;
my_bind[i].buffer_type= MYSQL_TYPE_STRING;
my_bind[i].is_null= 0;
my_bind[i].buffer= (char *)&parm[i];