fixed double-free with recent gpgme-lib

adjusted testfiles
going 1.3.1
This commit is contained in:
Thilo Raufeisen 2007-05-04 12:26:17 +00:00
parent 19dcb9fda3
commit 42c62c0ee8
5 changed files with 37 additions and 25 deletions

11
gnupg.c
View file

@ -27,7 +27,7 @@
static int le_gnupg; static int le_gnupg;
#define PHP_GNUPG_VERSION "1.3" #define PHP_GNUPG_VERSION "1.3.1"
#ifdef ZEND_ENGINE_2 #ifdef ZEND_ENGINE_2
static zend_object_handlers gnupg_object_handlers; static zend_object_handlers gnupg_object_handlers;
@ -934,7 +934,6 @@ PHP_FUNCTION(gnupg_sign){
RETVAL_STRINGL (userret,ret_size,1); RETVAL_STRINGL (userret,ret_size,1);
} }
gpgme_data_release (in); gpgme_data_release (in);
free (out);
free (userret); free (userret);
} }
@ -993,7 +992,6 @@ PHP_FUNCTION(gnupg_encrypt){
} }
userret = gpgme_data_release_and_get_mem(out,&ret_size); userret = gpgme_data_release_and_get_mem(out,&ret_size);
gpgme_data_release (in); gpgme_data_release (in);
free (out);
RETVAL_STRINGL (userret,ret_size,1); RETVAL_STRINGL (userret,ret_size,1);
free (userret); free (userret);
if(ret_size < 1){ if(ret_size < 1){
@ -1077,7 +1075,6 @@ PHP_FUNCTION(gnupg_encryptsign){
userret = gpgme_data_release_and_get_mem(out,&ret_size); userret = gpgme_data_release_and_get_mem(out,&ret_size);
gpgme_data_release (in); gpgme_data_release (in);
free (out);
RETVAL_STRINGL (userret,ret_size,1); RETVAL_STRINGL (userret,ret_size,1);
free (userret); free (userret);
if(ret_size < 1){ if(ret_size < 1){
@ -1166,10 +1163,8 @@ PHP_FUNCTION(gnupg_verify){
ZVAL_STRINGL (plain_text, gpg_plain,gpg_plain_len,1); ZVAL_STRINGL (plain_text, gpg_plain,gpg_plain_len,1);
} }
free (gpg_plain); free (gpg_plain);
gpgme_data_release_and_get_mem(gpgme_text,&gpg_plain_len);
} }
gpgme_data_release (gpgme_sig); gpgme_data_release (gpgme_sig);
free (gpgme_text);
} }
/* }}} */ /* }}} */
@ -1227,7 +1222,6 @@ PHP_FUNCTION(gnupg_decrypt){
} }
userret = gpgme_data_release_and_get_mem(out,&ret_size); userret = gpgme_data_release_and_get_mem(out,&ret_size);
gpgme_data_release (in); gpgme_data_release (in);
free (out);
RETVAL_STRINGL (userret,ret_size,1); RETVAL_STRINGL (userret,ret_size,1);
free (userret); free (userret);
if(ret_size < 1){ if(ret_size < 1){
@ -1292,7 +1286,6 @@ PHP_FUNCTION(gnupg_decryptverify){
if (decrypt_result->unsupported_algorithm){ if (decrypt_result->unsupported_algorithm){
GNUPG_ERR ("unsupported algorithm"); GNUPG_ERR ("unsupported algorithm");
gpgme_data_release(in); gpgme_data_release(in);
free(out);
return; return;
} }
verify_result = gpgme_op_verify_result (intern->ctx); verify_result = gpgme_op_verify_result (intern->ctx);
@ -1304,7 +1297,6 @@ PHP_FUNCTION(gnupg_decryptverify){
} }
gnupg_fetchsignatures (verify_result->signatures,sig_arr,return_value); gnupg_fetchsignatures (verify_result->signatures,sig_arr,return_value);
gpgme_data_release (in); gpgme_data_release (in);
free (out);
} }
/* }}} */ /* }}} */
@ -1346,7 +1338,6 @@ PHP_FUNCTION(gnupg_export){
RETVAL_FALSE; RETVAL_FALSE;
} }
free(userret); free(userret);
free(out);
} }
/* }}} */ /* }}} */

View file

@ -14,13 +14,11 @@
</maintainer> </maintainer>
</maintainers> </maintainers>
<release> <release>
<version>1.3</version> <version>1.3.1</version>
<date>2006-11-06</date> <date>2007-05-04</date>
<license>BSD, revised</license> <license>BSD, revised</license>
<state>stable</state> <state>stable</state>
<notes>PHP 5.2 compatibility <notes>fixed double-free with recent gpgme-lib</notes>
gnupg_deletekey now allows deleting a secret key in procedural usage
raised min version to 4.4</notes>
<deps> <deps>
<dep type="php" rel="ge" version="4.4"/> <dep type="php" rel="ge" version="4.4"/>
</deps> </deps>
@ -62,6 +60,13 @@ raised min version to 4.4</notes>
</filelist> </filelist>
</release> </release>
<changelog> <changelog>
<release>
<version>1.3.1</version>
<date>2007-05-04</date>
<license>BSD, revised</license>
<state>stable</state>
<notes>fixed double-free with recent gpgme-lib</notes>
</release>
<release> <release>
<version>1.3</version> <version>1.3</version>
<date>2006-11-06</date> <date>2006-11-06</date>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.4.9" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 <package packagerversion="1.4.11" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/tasks-1.0.xsd
http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0
http://pear.php.net/dtd/package-2.0.xsd"> http://pear.php.net/dtd/package-2.0.xsd">
@ -15,20 +15,18 @@ http://pear.php.net/dtd/package-2.0.xsd">
<email>traufeisen@php.net</email> <email>traufeisen@php.net</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2006-11-06</date> <date>2007-05-04</date>
<time>15:53:22</time> <time>14:26:36</time>
<version> <version>
<release>1.3</release> <release>1.3.1</release>
<api>1.3</api> <api>1.3.1</api>
</version> </version>
<stability> <stability>
<release>stable</release> <release>stable</release>
<api>stable</api> <api>stable</api>
</stability> </stability>
<license>BSD, revised</license> <license>BSD, revised</license>
<notes>PHP 5.2 compatibility <notes>fixed double-free with recent gpgme-lib
gnupg_deletekey now allows deleting a secret key in procedural usage
raised min version to 4.4
</notes> </notes>
<contents> <contents>
<dir name="/"> <dir name="/">
@ -81,6 +79,20 @@ raised min version to 4.4
<providesextension>gnupg</providesextension> <providesextension>gnupg</providesextension>
<extsrcrelease /> <extsrcrelease />
<changelog> <changelog>
<release>
<version>
<release>1.3.1</release>
<api>1.3.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2007-05-04</date>
<license uri="http://www.example.com">BSD, revised</license>
<notes>fixed double-free with recent gpgme-lib
</notes>
</release>
<release> <release>
<version> <version>
<release>1.3</release> <release>1.3</release>

View file

@ -72,7 +72,9 @@ array(1) {
bool(false) bool(false)
} }
[1]=> [1]=>
array(10) { array(11) {
["fingerprint"]=>
string(40) "A3437D3651E27CF9864198F0BFE8D07DDACDEAC8"
["keyid"]=> ["keyid"]=>
string(16) "BFE8D07DDACDEAC8" string(16) "BFE8D07DDACDEAC8"
["timestamp"]=> ["timestamp"]=>

View file

@ -70,7 +70,9 @@ array(1) {
bool(false) bool(false)
} }
[1]=> [1]=>
array(10) { array(11) {
["fingerprint"]=>
string(40) "A3437D3651E27CF9864198F0BFE8D07DDACDEAC8"
["keyid"]=> ["keyid"]=>
string(16) "BFE8D07DDACDEAC8" string(16) "BFE8D07DDACDEAC8"
["timestamp"]=> ["timestamp"]=>