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

Fix for CONC-458:

Fixed crash in mysql_get_timeout and mysql_get_timeout_ms functions,
which happened when no asynchronous context was set before.
This commit is contained in:
Georg Richter
2020-03-05 09:50:12 +01:00
parent 6a0c8ff2e5
commit d4f75481f6
2 changed files with 16 additions and 2 deletions

View File

@@ -1751,7 +1751,10 @@ void ma_invalidate_stmts(MYSQL *mysql, const char *function_name)
unsigned int STDCALL
mysql_get_timeout_value(const MYSQL *mysql)
{
unsigned int timeout= mysql->options.extension->async_context->timeout_value;
unsigned int timeout= 0;
if (mysql->options.extension && mysql->options.extension->async_context)
timeout= mysql->options.extension->async_context->timeout_value;
/* Avoid overflow. */
if (timeout > UINT_MAX - 999)
return (timeout - 1)/1000 + 1;
@@ -1763,7 +1766,9 @@ mysql_get_timeout_value(const MYSQL *mysql)
unsigned int STDCALL
mysql_get_timeout_value_ms(const MYSQL *mysql)
{
return mysql->options.extension->async_context->timeout_value;
if (mysql->options.extension && mysql->options.extension->async_context)
return mysql->options.extension->async_context->timeout_value;
return 0;
}
/**************************************************************************