From:             owen at name dot com
Operating system: RedHat/Linux version 2.4.20-8
PHP version:      4.3.6
PHP Bug Type:     OpenSSL related
Bug description:  openssl_pkcs7_encrypt segmentation fault

Description:
------------
When using openssl_pkcs7_encrypt, Apache seg faults. I can perform the
same smime related function with openssl alone but not in PHP.

I have tried different sized messages, different headers, different certs,
etc and it always seg faults.

Reproduce code:
---------------
            $headers_array = explode("\r\n", $header);
            $infilename = tempnam("/tmp/", "smime-in-");
            $outfilename = tempnam("/tmp/", "smime-out-");
            unlink($outfilename);

            $fp2 = fopen($infilename, "w");
            fwrite($fp2, $mimeData.substr($message, strpos($message,
"\r\n\r\n") + 2)."\r\n");
            fclose($fp2);
            $cert = $cert_array[0];
            $encrypted = openssl_pkcs7_encrypt($infilename, $outfilename,
$cert, $headers_array, 0);


Expected result:
----------------
smime encrypted data to be written to $outfilename.

Actual result:
--------------
When ran in a browser the page stays the same and doesn't move on to the
page the code is being ran on and I get "child pid 5314 exit signal
Segmentation fault (11)" in the Apache error log. When ran from the
command line I get a sefmentation fault and a core dumped.

Here is the backtrace. Doesn't seem to be much there.

(gdb) bt
#0  0x08224f5d in PKCS7_dataInit ()
#1  0x08380160 in ?? ()


-- 
Edit bug report at http://bugs.php.net/?id=28552&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28552&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28552&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28552&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28552&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28552&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28552&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28552&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28552&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28552&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28552&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28552&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28552&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28552&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28552&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28552&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28552&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28552&r=float

Reply via email to