Bug #68912 [NEW]: Segmentation fault at openssl_spki_new
| From: | fernando at null-life dot com | Date: | Sun, 25 Jan 2015 18:03:24 +0000 |
| Subject: | Bug #68912 [NEW]: Segmentation fault at openssl_spki_new | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-190219@lists.php.net to get a copy of this message | ||
From: fernando at null-life dot com
Operating system: Linux
PHP version: 5.6.5
Package: OpenSSL related
Bug Type: Bug
Bug description:Segmentation fault at openssl_spki_new
Description:
------------
There is a segfault when calling openssl_spki_new with an invalid
resource. I *think* it may be related to calling strlen(s) when s is
NULL.
Test script:
---------------
<?php
$var1=xml_parser_create_ns();
$var2=2;
$var3=3;
openssl_spki_new($var1, $var2, $var3);
Expected result:
----------------
Not segfault
Actual result:
--------------
(gdb) run 2.php
Starting program: /usr/bin/php 2.php
PHP Warning: openssl_spki_new(): supplied resource is not a valid
OpenSSL X.509/key resource in /home/fmunozs/bugs/php/2.php on line 8
PHP Warning: openssl_spki_new(): Unable to use supplied private key in
/home/fmunozs/bugs/php/2.php on line 8
Program received signal SIGSEGV, Segmentation fault.
zif_openssl_spki_new (ht=3, return_value=0xb788acb0,
return_value_ptr=0xb787007c, this_ptr=0x0, return_value_used=0) at
/home/fmunozs/php/src/php-5.6.5/ext/openssl/openssl.c:1535
1535 if (strlen(s) <= 0) {
(gdb) bt
#0 zif_openssl_spki_new (ht=3, return_value=0xb788acb0,
return_value_ptr=0xb787007c, this_ptr=0x0, return_value_used=0) at
/home/fmunozs/php/src/php-5.6.5/ext/openssl/openssl.c:1535
#1 0x08ce66ed in zend_do_fcall_common_helper_SPEC
(execute_data=0xb78700c8) at
/home/fmunozs/php/src/php-5.6.5/Zend/zend_vm_execute.h:558
#2 0x08b2eacf in execute_ex (execute_data=0xb78700c8) at
/home/fmunozs/php/src/php-5.6.5/Zend/zend_vm_execute.h:363
#3 0x08bc2eac in zend_execute (op_array=0xb7889e28) at
/home/fmunozs/php/src/php-5.6.5/Zend/zend_vm_execute.h:388
#4 0x08a2f46b in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/fmunozs/php/src/php-5.6.5/Zend/zend.c:1341
#5 0x0884cf7e in php_execute_script (primary_file=0xbfffe494) at
/home/fmunozs/php/src/php-5.6.5/main/main.c:2584
#6 0x08cee870 in do_cli (argc=-1, argc@entry=2, argv=0xb788a228,
argv@entry=0x94da838) at
/home/fmunozs/php/src/php-5.6.5/sapi/cli/php_cli.c:994
#7 0x0806c7e9 in main (argc=2, argv=0x94da838) at
/home/fmunozs/php/src/php-5.6.5/sapi/cli/php_cli.c:1378
#8 0xb7976e5e in __libc_start_main () from /usr/lib/libc.so.6
#9 0x0806c9f7 in _start ()
--
Edit bug report at https://bugs.php.net/bug.php?id=68912&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68912&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68912&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68912&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68912&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68912&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68912&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68912&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68912&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68912&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68912&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68912&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68912&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68912&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68912&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68912&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68912&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68912&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68912&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68912&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68912&r=mysqlcfg