php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58822 php segfaults when trying to use gnupg with the latest version of gpgme (1.2.0)
Submitted: 2009-08-21 16:14 UTC Modified: 2010-07-20 14:51 UTC
From: mtorromeo@php.net Assigned:
Status: Closed Package: gnupg (PECL)
PHP Version: 5.2.10 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mtorromeo@php.net
New email:
PHP Version: OS:

 

 [2009-08-21 16:14 UTC] mtorromeo@php.net
Description:
------------
gnupg compiled against gpgme-1.2.0 installs fine but when trying to initialize a new gnupg object, the interpreter segfaults.

The extension compiled with gpgme-1.1.8 works fine.

Thanks for the support.

Reproduce code:
---------------
<?php echo get_class(new gnupg()); ?>

Expected result:
----------------
gnupg

Actual result:
--------------
segmentation fault

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-22 05:56 UTC] massimiliano dot torromeo at gmail dot com
After a little research I found that the fix is easy.
gpgme_new() will fail if you don't call gpgme_check_version() before.

See the following patch:

--- ../gnupg-1.3.1/gnupg.c      2007-05-04 15:23:41.000000000 +0200
+++ gnupg.c     2009-08-22 11:48:37.417962545 +0200
@@ -136,6 +136,7 @@
 static void gnupg_res_init(gnupg_object *intern TSRMLS_DC){
        /* init the gpgme-lib and set the default values */
        gpgme_ctx_t     ctx;
+       gpgme_check_version                             (0);
        gpgme_new                                       (&ctx);
        gpgme_set_armor                         (ctx,1);
        intern->ctx                             =       ctx;
 [2010-01-13 23:20 UTC] pclus at mailinator dot com
Suggested fix works on issue, with pecl version (1.3.1)

php 5.2.12
libgpgme11 1.2.0

Tip for anyone using pecl and finding this bug report, make the change to the source code in the pear download directory (mine was /tmp/pear/download) and then run pear install gnupg-1.3.1.tgz


PS. Line number is 139
 [2010-07-20 14:51 UTC] pierre dot php at gmail dot com
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC