[CONC-83] Crash by a NULL dereferencing of stmt->mysql in mysql_stmt_prepare after computer wake up from suspended state Created: 2014-03-11  Updated: 2014-06-09  Resolved: 2014-03-13

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Eric Trinh Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None
Environment:

Win64 build with mingw64 4.8.0
Library r118, MariaDB 5.5.33a and Qt4.8.5


Attachments: JPEG File mariadbnativeclientCrash.jpg    
Issue Links:
Relates
relates to CONC-97 Crash by a NULL dereferencing of stmt... Closed

 Description   

Hi,

We have sometimes crash of the library inside call of mysql_stmt_prepare.

The stmt->mysql is NULL and dereferenced.

The last error states a lost connection, which can be normal. The crash happened just after a wake up of a suspended state of the computer.

I have included a screenshot, with the state of all variables when app was crashing, if it can help.

We are using vanilla r118 of the library.

Thanks,
Best Regards,
Eric



 Comments   
Comment by Georg Richter [ 2014-03-12 ]

Crash happens, if reconnect option is enabled.

static int test_conc83(MYSQL *mysql)
{
  MYSQL_STMT *stmt;
  int rc;
 
  char *query= "SELECT 1,2,3 FROM DUAL";
 
  stmt= mysql_stmt_init(mysql);
 
  mysql->reconnect= 1;
 
  rc= mysql_kill(mysql, mysql_thread_id(mysql));
 
  rc= mysql_stmt_prepare(stmt, query, strlen(query));
  FAIL_IF(!rc, "Error expected");
 
  mysql_stmt_close(stmt);
  return OK;
}

Comment by Eric Trinh [ 2014-03-12 ]

Yes, I confirm, we have reconnect option enabled.

Comment by Georg Richter [ 2014-03-13 ]

Fixed in rev.122

Generated at Thu Feb 08 03:02:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.