File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ PHP NEWS
1111- OpenSSL:
1212 . Prevent unexpected array entry conversion when reading key. (nielsdos)
1313 . Fix various memory leaks related to openssl exports. (nielsdos)
14+ . Fix memory leak in php_openssl_pkey_from_zval(). (nielsdos)
1415
1516- PDO:
1617 . Fixed memory leak of `setFetchMode()`. (SakiTakamachi)
Original file line number Diff line number Diff line change @@ -3533,6 +3533,7 @@ static EVP_PKEY *php_openssl_pkey_from_zval(
35333533 } else {
35343534 ZVAL_COPY (& tmp , zphrase );
35353535 if (!try_convert_to_string (& tmp )) {
3536+ zval_ptr_dtor (& tmp );
35363537 return NULL ;
35373538 }
35383539
Original file line number Diff line number Diff line change 1+ --TEST--
2+ php_openssl_pkey_from_zval memory leak
3+ --EXTENSIONS--
4+ openssl
5+ --FILE--
6+ <?php
7+
8+ class StrFail {
9+ public function __toString (): string {
10+ throw new Error ('create a leak ' );
11+ }
12+ }
13+
14+ $ key = ["" , new StrFail ];
15+ try {
16+ openssl_pkey_export_to_file ($ key , "doesnotmatter " );
17+ } catch (Error $ e ) {
18+ echo $ e ->getMessage (), "\n" ;
19+ }
20+
21+ ?>
22+ --EXPECT--
23+ create a leak
You can’t perform that action at this time.
0 commit comments