File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -3214,6 +3214,7 @@ PHP_FUNCTION(openssl_pkey_get_public)
3214
3214
if (pkey == NULL ) {
3215
3215
RETURN_FALSE ;
3216
3216
}
3217
+ zend_list_addref (Z_LVAL_P (return_value ));
3217
3218
}
3218
3219
/* }}} */
3219
3220
@@ -3250,6 +3251,7 @@ PHP_FUNCTION(openssl_pkey_get_private)
3250
3251
if (pkey == NULL ) {
3251
3252
RETURN_FALSE ;
3252
3253
}
3254
+ zend_list_addref (Z_LVAL_P (return_value ));
3253
3255
}
3254
3256
3255
3257
/* }}} */
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #61930: openssl corrupts ssl key resource when using openssl_get_publickey()
3
+ --SKIPIF--
4
+ <?php
5
+ if (!extension_loaded ("openssl " )) die ("skip " );
6
+ ?>
7
+ --FILE--
8
+ <?php
9
+ $ cert = file_get_contents (__DIR__ .'/cert.crt ' );
10
+
11
+ $ data = <<<DATA
12
+ Please verify me
13
+ DATA ;
14
+
15
+ $ sig = 'f9Gyb6NV/ENn7GUa37ygTLcF93XHf5fbFTnoYF/O+fXbq3iChGUbET0RuhOsptlAODi6JsDLnJO4ikcVZo0tC1fFTj3LyCuPy3ZdgJbbVxQ/rviROCmuMFTqUW/Xa2LQYiapeCCgLQeWTLg7TM/BoHEkKbKLG/XT5jHvep1758A= ' ;
16
+
17
+ $ key = openssl_get_publickey ($ cert );
18
+ var_dump (openssl_get_publickey ($ key ));
19
+ var_dump (openssl_verify ($ data , base64_decode ($ sig ), $ key ));
20
+ ?>
21
+ --EXPECTF--
22
+ resource(%d) of type (OpenSSL key)
23
+ int(1)
24
+
You can’t perform that action at this time.
0 commit comments