Bug #69004 [NEW]: openssl_pkcs12_export_to_file segfault

From: Date: Sat, 07 Feb 2015 09:32:42 +0000
Subject: Bug #69004 [NEW]: openssl_pkcs12_export_to_file segfault
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190502@lists.php.net to get a copy of this message
From: gmblar+php at gmail dot com Operating system: MacOSX 10.10.2 PHP version: 5.6.5 Package: OpenSSL related Bug Type: Bug Bug description:openssl_pkcs12_export_to_file segfault Description: ------------ openssl_pkcs12_export_to_file crash with "Segmentation fault: 11" Code works without segfault if: * remove the line "$privateKey = new PrivateKey($privateKey);" * var_dump something after openssl_pkcs12_export_to_file Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x000000012b86af59 0x00000001001f0c25 in gc_zval_possible_root () (gdb) bt #0 0x00000001001f0c25 in gc_zval_possible_root () #1 0x00000001001e2046 in zend_hash_bucket_delete () #2 0x00000001001e20ac in zend_hash_graceful_reverse_destroy () #3 0x00000001001c8027 in shutdown_executor () #4 0x00000001001d6227 in zend_deactivate () #5 0x000000010017d045 in php_request_shutdown () #6 0x000000010025f7d7 in do_cli () #7 0x000000010025e354 in main () Test script: --------------- <?php class PrivateKey { public $data; public function __construct($data) { $this->data = $data; } public function __toString() { openssl_pkey_export($this->data, $output); return $output; } } $csr = openssl_csr_new([], $privateKey); $certificate = openssl_csr_sign($csr, NULL, $privateKey, 1); $privateKey = new PrivateKey($privateKey); openssl_pkcs12_export_to_file($certificate, '/tmp/test.p12', $privateKey, ''); # var_dump('bar'); Expected result: ---------------- Nothing Actual result: -------------- Segmentation fault: 11 -- Edit bug report at https://bugs.php.net/bug.php?id=69004&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69004&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69004&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69004&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69004&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69004&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69004&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69004&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69004&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69004&r=support Expected behavior: https://bugs.php.net/fix.php?id=69004&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69004&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69004&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69004&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69004&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69004&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69004&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69004&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69004&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69004&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69004&r=mysqlcfg

« previous php.bugs (#190502) next »