php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57634 gnupg_encrypt crashes script
Submitted: 2007-04-25 09:47 UTC Modified: 2007-05-04 09:55 UTC
From: webmaster at prontonyc dot com Assigned: traufeisen (profile)
Status: Closed Package: gnupg (PECL)
PHP Version: 4.4.6 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: webmaster at prontonyc dot com
New email:
PHP Version: OS:

 

 [2007-04-25 09:47 UTC] webmaster at prontonyc dot com
Description:
------------
When I try to encrypt a short text with gnupg_encrypt(), the script exits abruptly.

The script does successfully run gnupg_addencryptkey().  I am also able to run gnupg_keyinfo() and get back information that appears to be accurate.

Thank you.

Reproduce code:
---------------
putenv("GNUPGHOME=/home/pronto/.gnupg/");
$res = gnupg_init();
$gpgak = gnupg_addencryptkey
    ( $res, '9F5C955672FE54F6F793051C5BC1FB2C98410BC4' );
if (FALSE == $gpgak) {
  echo gnupg_geterror($res) . "<hr />\n";
}
$gpgcr = $cryptemail = gnupg_encrypt($res, 'test');
if (FALSE == $gpgcr) {
  echo gnupg_geterror($res). "<hr />\n";
}
print "<p>Encryption finished.  Now preparing message.</p>\n";

Expected result:
----------------
The final message.

Actual result:
--------------
Nothing.  The script terminates without executing or printing anything after the call to gnupg_encrypt().

Until last night, the following error appeared in the error log:

"[9996] EACCELERATOR: PHP crashed on opline 34 of gnupg_encrypt() at /home/pronto/public_html/test/18/pgpemailtest.php:92".

After I reported this to my hosting company, they stopped the error from appearing, but the function still doesn't work.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-25 09:50 UTC] webmaster at prontonyc dot com
My PHP version is 4.4.6; that version wasn't in the drop-down list, so I put 4.4.5.
 [2007-04-25 09:57 UTC] webmaster at prontonyc dot com
Here is my phpinfo:

http://www.prontonyc.com/phpinfo.php
 [2007-04-25 17:37 UTC] traufeisen@php.net
Can you please provide a backtrace?
If possible, try to reproduce the segfault on the console.
Details on how to generate a backtrace can be found at http://bugs.php.net/bugs-generating-backtrace.php
Basically

gdb /path/to/php
run /path/to/script
<segfault>
bt full
 [2007-04-27 15:17 UTC] webmaster at prontonyc dot com
Thanks; it was installed in a shared hosting environment, and I do not have access to the command line.  I have asked the hosting provider if they can generate a backtrace, but I do not know if they will have the time.
 [2007-04-28 10:49 UTC] webmaster at prontonyc dot com
Here is the backtrace sent by my hosting provider:

(gdb) run gnupg_encryptsign.php
Starting program: /usr/local/bin/php gnupg_encryptsign.php
Reading symbols from shared object read from target memory...done.
Loaded system supplied DSO at 0xb7f89000
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 17942)]
Detaching after fork from child process 29694.
Detaching after fork from child process 22864.
Detaching after fork from child process 17081.
Detaching after fork from child process 28824.
*** glibc detected *** double free or corruption (!prev): 0x0856b288 ***

Program received signal SIGABRT, Aborted.
[Switching to Thread 16384 (LWP 17942)]
0x4f21fba1 in kill () from /lib/i686/libc.so.6
(gdb) bt
#0 0x4f21fba1 in kill () from /lib/i686/libc.so.6
#1 0x4f399271 in pthread_kill () from /lib/i686/libpthread.so.0
#2 0x4f3995db in raise () from /lib/i686/libpthread.so.0
#3 0x4f21f808 in raise () from /lib/i686/libc.so.6
#4 0x4f220f10 in abort () from /lib/i686/libc.so.6
#5 0x4f25377e in __libc_message () from /lib/i686/libc.so.6
#6 0x4f259e7f in _int_free () from /lib/i686/libc.so.6
#7 0x4f25a226 in free () from /lib/i686/libc.so.6
#8 0xb78e098f in zif_gnupg_encryptsign (ht=2, return_value=0x4f31e9c0, this_ptr=0x0, return_value_used=1)
at /root/gnupg-1.3/gnupg.c:1080
#9 0xb780648f in zend_optimizer_set_oe_ex () from /usr/local/Zend/lib/Optimizer-3.2.0/php-4.4.x/ZendOptimizer.so
#10 0x00000002 in ?? ()
#11 0x08561f5c in ?? ()
#12 0x00000000 in ?? ()
(gdb)
 [2007-04-28 10:50 UTC] webmaster at prontonyc dot com
They also sent this, which may be useful to you:

pid 32365] <... read resumed> "-----BEGIN PGP MESSAGE-----\nVers"..., 4096) = 1014
[pid 32365] select(12, [4 11], [], NULL, {1, 0} <unfinished ...>
[pid 26388] open("/home/pronto/.gnupg/random_seed", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600 <unfinished ...>
[pid 32365] <... select resumed> ) = 1 (in [4], left {1, 0})
[pid 26388] <... open resumed> ) = 15
[pid 32365] select(5, [4], [], NULL, {0, 0} <unfinished ...>
[pid 26388] write(15, "\3479\0\263\323\3408Q\334\200\3244v\'\203.i\342+\335\225"..., 600 <unfinished ...>
[pid 32365] <... select resumed> ) = 1 (in [4], left {0, 0})
[pid 32365] read(4, <unfinished ...>
[pid 26388] <... write resumed> ) = 600
[pid 32365] <... read resumed> "[GNUPG:] END_ENCRYPTION\n", 1024) = 24
[pid 26388] close(15 <unfinished ...>
[pid 32365] select(12, [4 11], [], NULL, {1, 0} <unfinished ...>
[pid 26388] <... close resumed> ) = 0
[pid 26388] munmap(0xb7f98000, 32768) = 0
[pid 26388] unlink("/home/pronto/.gnupg/.#lk0x800af138.ocean.hostingzoom.com.26388") = 0
[pid 26388] exit_group(0) = ?
Process 26388 detached
<... select resumed> ) = 1 (in [11], left {0, 996000})
select(12, [11], [], NULL, {0, 0}) = 1 (in [11], left {0, 0})
read(11, "", 4096) = 0
close(11) = 0
select(5, [4], [], NULL, {1, 0}) = 1 (in [4], left {1, 0})
select(5, [4], [], NULL, {0, 0}) = 1 (in [4], left {0, 0})
read(4, "", 1024) = 0
close(4) = 0
open("/dev/tty", O_RDWR|O_NONBLOCK|O_NOCTTY) = 4
writev(4, [{"*** glibc detected *** ", 23}, {"double free or corruption (!prev"..., 33}, {": 0x", 4}, {"0856b7f8", 8}, {" ***\n", 5}], 5*** glibc detected *** double free or corruption (!prev): 0x0856b7f8 ***
) = 73
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
kill(32365, SIGABRT) = 0
--- SIGABRT (Aborted) @ 0 (0) ---
+++ killed by SIGABRT (core dumped) +++
 [2007-05-04 09:55 UTC] traufeisen@php.net
Thanks for the backtrace.
This issue occurs with recent gpgme-libs and is now fixed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC