com php-src: Fix #77578: Crash when php unload: NEWS ext/com_dotnet/com_typeinfo.c ext/com_dotnet/tests/bu g77578.phpt
| From: | Christoph Michael Becker | Date: | Mon, 18 Mar 2019 18:21:38 +0000 |
| Subject: | com php-src: Fix #77578: Crash when php unload: NEWS ext/com_dotnet/com_typeinfo.c ext/com_dotnet/tests/bu g77578.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105223@lists.php.net to get a copy of this message | ||
Commit: 41bc51ce2d217aa7aca85b4be289bebf91813423
Author: Christoph M. Becker <cmbecker69@gmx.de> Mon, 18 Mar 2019 18:47:34 +0100
Parents: f21c0549030762f8403f57eef375af9f946133e7
Branches: PHP-7.2 PHP-7..3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=41bc51ce2d217aa7aca85b4be289bebf91813423
Log:
Fix #77578: Crash when php unload
Since we're putting
ITypeLib *s into the hash, we're getting
ITypeLib *s back, not ITypeLib **s.
Bugs:
https://bugs.php.net/77578
Changed paths:
M NEWS
M ext/com_dotnet/com_typeinfo.c
A ext/com_dotnet/tests/bug77578.phpt
Diff:
diff --git a/NEWS b/NEWS
index abf5a57..1e953a1 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,9 @@ PHP NEWS
. Fixed bug #77742 (bcpow() implementation related to gcc compiler
optimization). (Nikita)
+- COM:
+ . Fixed bug #77578 (Crash when php unload). (cmb)
+
- Date:
. Fixed bug #50020 (DateInterval:createDateFromString() silently fails).
(Derick)
diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c
index 40f21ae..1847a56 100644
--- a/ext/com_dotnet/com_typeinfo.c
+++ b/ext/com_dotnet/com_typeinfo.c
@@ -225,8 +225,8 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
/* Type-library stuff */
void php_com_typelibrary_dtor(zval *pDest)
{
- ITypeLib **Lib = (ITypeLib**)Z_PTR_P(pDest);
- ITypeLib_Release(*Lib);
+ ITypeLib *Lib = (ITypeLib*)Z_PTR_P(pDest);
+ ITypeLib_Release(Lib);
}
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
diff --git a/ext/com_dotnet/tests/bug77578.phpt b/ext/com_dotnet/tests/bug77578.phpt
new file mode 100644
index 0000000..e684944
--- /dev/null
+++ b/ext/com_dotnet/tests/bug77578.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #77578 (Crash when php unload)
+--SKIPIF--
+<?php
+if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not
available');
+?>
+--FILE--
+<?php
+// To actually be able to verify the crash during shutdown on Windows, we have
+// to execute a PHP subprocess, and check its exit status.
+$php = PHP_BINARY;
+$ini = php_ini_loaded_file();
+$iniopt = $ini ? "-c $ini" : '';
+$command = "$php $iniopt -d com.autoregister_typelib=1 -r \"new
COM('WbemScripting.SWbemLocator');\"";
+exec($command, $output, $status);
+var_dump($output, $status);
+?>
+===DONE===
+--EXPECT--
+array(0) {
+}
+int(0)
+===DONE===