[php-src] Issue #9143: Mysql PDO heap corruption on Win10 x64 1909 (PHP x86 NTS)
| From: | nerdspice | Date: | Mon, 25 Jul 2022 22:08:44 +0000 |
| Subject: | [php-src] Issue #9143: Mysql PDO heap corruption on Win10 x64 1909 (PHP x86 NTS) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242021@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9143
Author: nerdspice
### Description
The following code:
```php
<?php
define('DB_DRIVER', 'mysql');
define('DB_HOST', 'localhost');
define('DB_PORT', 3306);
define('DB_USER', '[removed]');
define('DB_PASS', '[removed]');
define('DB_NAME', '[removed]');
define('DB_DSN' ,
DB_DRIVER.':dbname='.DB_NAME.';host='.DB_HOST.';port='.DB_PORT);
$params = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_PERSISTENT => true,
PDO::ATTR_EMULATE_PREPARES => false,
PDO::MYSQL_ATTR_INIT_COMMAND => "SET SESSION sql_mode='',
group_concat_max_len=32000, time_zone='+00:00'"
);
$params[PDO::ATTR_DEFAULT_FETCH_MODE] = PDO::FETCH_OBJ;
$handle = new PDO(DB_DSN, DB_USER, DB_PASS, $params);
```
Resulted in this output:
Random crashes with the following in Event Viewer:
```
Faulting application name: php-cgi.exe, version: 8.1.8.0, time stamp: 0x62c4c3bb
Faulting module name: ntdll.dll, version: 10.0.18362.719, time stamp: 0x832e7bce
Exception code: 0xc0000374
Fault offset: 0x000df95d
Faulting process id: 0x5458
Faulting application start time: 0x01d8a070256f66a2
Faulting application path: C:\Program Files (x86)\php81\php-cgi.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: a41ae7dc-55de-4152-b401-9553e23d1b5d
Faulting package full name:
Faulting package-relative application ID:
```
But I expected this output instead:
```
Successful database connection and no crashing.
```
Other notes:
This issue seems to be somewhat random, but I was able to get it to consistently crash if I kill the
idle db connection via the sql command
kill <id>;, then refresh the page. Using
IIS 10 configured to hand-off the request to php via fastcgi. Database server attempting to connect
to is on the same machine - Version: 10.4.12-MariaDB-log - Win10 x64. DebugDiag log
attached (zipped due to file ext limitation on github).
[php-cgi.exe_220725_131714_CrashHangAnalysis.zip](https://github.com/php/php-src/files/9184975/php-cgi.exe_220725_131714_CrashHangAnalysis.zip)
### PHP Version
PHP 8.1.8 x86
### Operating System
Windows 10 x64 1909