mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79145: openssl memory leak
This commit is contained in:
commit
16a8a608d5
3 changed files with 29 additions and 2 deletions
3
NEWS
3
NEWS
|
@ -24,6 +24,9 @@ PHP NEWS
|
|||
. Fixed #79114 (Eval class during preload causes class to be only half
|
||||
available). (Laruence)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #79145 (openssl memory leak). (cmb, Nikita)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #79115 (ReflectionClass::isCloneable call reflected class
|
||||
__destruct). (Nikita)
|
||||
|
|
|
@ -4767,7 +4767,6 @@ PHP_FUNCTION(openssl_pkey_get_public)
|
|||
RETURN_FALSE;
|
||||
}
|
||||
ZVAL_RES(return_value, res);
|
||||
Z_ADDREF_P(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -4809,7 +4808,6 @@ PHP_FUNCTION(openssl_pkey_get_private)
|
|||
RETURN_FALSE;
|
||||
}
|
||||
ZVAL_RES(return_value, res);
|
||||
Z_ADDREF_P(return_value);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
|
26
ext/openssl/tests/bug79145.phpt
Normal file
26
ext/openssl/tests/bug79145.phpt
Normal file
|
@ -0,0 +1,26 @@
|
|||
--TEST--
|
||||
Bug #79145 (openssl memory leak)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('openssl')) die('skip openssl extension not available');
|
||||
if (getenv('SKIP_SLOW_TESTS')) die('skip slow test');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$b = '-----BEGIN PUBLIC KEY-----
|
||||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDaFhc31WeskqxwI+Si5R/fZrLK
|
||||
pJOlABiI3RZfKCHJVrXl3IvcHDFM/BHKUJoSi/ee8GS9iw0G4Z1eCzJdthXxHARh
|
||||
j85Q5OliVxOdB1LoTOsOmfFf/fdvpU3DsOWsDKlVrL41MHxXorwrwOiys/r/gv2d
|
||||
C9C4JmhTOjBVAK8SewIDAQAC
|
||||
-----END PUBLIC KEY-----';
|
||||
|
||||
$start = memory_get_usage(true);
|
||||
for ($i = 0; $i < 100000; $i++) {
|
||||
$a = openssl_get_publickey($b);
|
||||
openssl_free_key($a);
|
||||
}
|
||||
$end = memory_get_usage(true);
|
||||
var_dump($end <= 1.1 * $start);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
Loading…
Add table
Add a link
Reference in a new issue