Skip to content

Commit

Permalink
Merge branch '3.1' into 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vaintroub committed Nov 12, 2020
2 parents 02f9574 + 777460c commit b4bc6bd
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 7 deletions.
14 changes: 7 additions & 7 deletions libmariadb/secure/schannel_certs.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ static DWORD get_last_error()
return ERROR_INTERNAL_ERROR;
}

#define FAIL(fmt,...) \
{\
status = get_last_error();\
ma_format_win32_error(errmsg, errmsg_len, status, fmt, __VA_ARGS__);\
goto cleanup;\
}
#define FAIL(...) \
do{\
status = get_last_error();\
ma_format_win32_error(errmsg, errmsg_len, status, __VA_ARGS__);\
goto cleanup;\
} while (0)

/*
Load file into memory. Add null terminator at the end, so it will be a valid C string.
Expand Down Expand Up @@ -654,7 +654,7 @@ static SECURITY_STATUS load_private_key(CERT_CONTEXT* cert, char* private_key_st
derbuf = LocalAlloc(0, derlen);
if (!derbuf)
{
FAIL("LocalAlloc failed")
FAIL("LocalAlloc failed");
}

if (!CryptStringToBinaryA(private_key_str, (DWORD)len, CRYPT_STRING_BASE64HEADER, derbuf, &derlen, NULL, NULL))
Expand Down
38 changes: 38 additions & 0 deletions unittest/libmariadb/ps_bugs.c
Original file line number Diff line number Diff line change
Expand Up @@ -5275,7 +5275,45 @@ static int test_conc504(MYSQL *mysql)
return OK;
}

static int test_conc512(MYSQL *mysql)
{
int rc;
MYSQL_STMT *stmt;
MYSQL_BIND bind;
float f;

rc= mysql_query(mysql, "drop table if exists t1");

rc= mysql_real_query(mysql, SL("CREATE TABLE t1 (a int)"));

rc= mysql_real_query(mysql, SL("INSERT INTO t1 VALUES (1073741825)"));

stmt= mysql_stmt_init(mysql);
rc= mysql_stmt_prepare(stmt, SL("SELECT a FROM t1"));
check_stmt_rc(rc, stmt);

memset(&bind, 0, sizeof(MYSQL_BIND));
bind.buffer= &f;
bind.buffer_type= MYSQL_TYPE_FLOAT;

rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt);

rc= mysql_stmt_bind_result(stmt, &bind);
check_stmt_rc(rc, stmt);

rc= mysql_stmt_fetch(stmt);
FAIL_IF(rc != 101, "Truncation expected");

mysql_stmt_close(stmt);

rc= mysql_query(mysql, "DROP TABLE t1");
check_mysql_rc(rc, mysql);
return OK;
}

struct my_tests_st my_tests[] = {
{"test_conc512", test_conc512, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc504", test_conc504, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_returning", test_returning, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_mdev_21920", test_mdev_21920, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
Expand Down

0 comments on commit b4bc6bd

Please sign in to comment.