Bug #74071 [NEW]: Segfault in php_stream_context_set_option
| From: | kelunik@php.net | Date: | Fri, 10 Feb 2017 08:21:12 +0000 |
| Subject: | Bug #74071 [NEW]: Segfault in php_stream_context_set_option | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-207241@lists.php.net to get a copy of this message | ||
From: kelunik
Operating system: Linux
PHP version: Next Minor Version
Package: Sockets related
Bug Type: Bug
Bug description:Segfault in php_stream_context_set_option
Description:
------------
PHP segfaults when requesting HTTPS sites using
https://github.com/amphp/artax @ ^2. I haven't
been able yet to write a
condensed test script.
Works fine with PHP 7.1.2RC1, but not with the current master.
Test script:
---------------
require __DIR__ . "/vendor/autoload.php";
Amp\run(function () {
yield (new Amp\Artax\Client)->request("https://php.net/");
});'
Expected result:
----------------
No segfault.
Actual result:
--------------
php: /home/kelunik/.php-build/release/Zend/zend_hash.c:550:
_zend_hash_add_or_update_i: Assertion `((ht)->gc.refcount == 1) ||
((ht)->u.flags & (1<<6))' failed.
Program received signal SIGABRT, Aborted.
0x00007ffff49c2428 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:54
54 ../sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis nicht
gefunden.
(gdb) bt
#0 0x00007ffff49c2428 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:54
#1 0x00007ffff49c402a in __GI_abort () at abort.c:89
#2 0x00007ffff49babd7 in __assert_fail_base (fmt=<optimized out>,
assertion=assertion@entry=0x12586b8 "((ht)->gc.refcount == 1) ||
((ht)->u.flags & (1<<6))",
file=file@entry=0x1258640
"/home/kelunik/.php-build/release/Zend/zend_hash.c",
line=line@entry=550, function=function@entry=0x12589e0
<__PRETTY_FUNCTION__.8867> "_zend_hash_add_or_update_i") at assert.c:92
#3 0x00007ffff49bac82 in __GI___assert_fail (assertion=0x12586b8
"((ht)->gc.refcount == 1) || ((ht)->u.flags & (1<<6))", file=0x1258640
"/home/kelunik/.php-build/release/Zend/zend_hash.c", line=550,
function=0x12589e0 <__PRETTY_FUNCTION__.8867>
"_zend_hash_add_or_update_i") at assert.c:101
#4 0x000000000098a756 in _zend_hash_add_or_update_i (ht=0x7fffedf9c900,
key=0x7fffedf0cf40, pData=0x7fffffffa040, flag=1,
__zend_filename=0x123cb88
"/home/kelunik/.php-build/release/main/streams/streams.c",
__zend_lineno=2237) at
/home/kelunik/.php-build/release/Zend/zend_hash.c:550
#5 0x000000000098acb1 in _zend_hash_str_update (ht=0x7fffedf9c900,
str=0x7fffedece318 "ssl", len=3, pData=0x7fffffffa040,
__zend_filename=0x123cb88
"/home/kelunik/.php-build/release/main/streams/streams.c",
__zend_lineno=2237) at
/home/kelunik/.php-build/release/Zend/zend_hash.c:653
#6 0x0000000000908a70 in php_stream_context_set_option
(context=0x7fffedfc9540, wrappername=0x7fffedece318 "ssl",
optionname=0x7fffede9cba8 "peer_name", optionvalue=0x7fffed60c0a0)
at /home/kelunik/.php-build/release/main/streams/streams.c:2237
#7 0x000000000084686f in parse_context_options (context=0x7fffedfc9540,
options=0x7fffede169c0) at
/home/kelunik/.php-build/release/ext/standard/streamsfuncs.c:896
#8 0x00000000008471f2 in zif_stream_context_set_option
(execute_data=0x7fffede16960, return_value=0x7fffffffa1e0) at
/home/kelunik/.php-build/release/ext/standard/streamsfuncs.c:1007
#9 0x00000000009d7f45 in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER () at
/home/kelunik/.php-build/release/Zend/zend_vm_execute.h:620
#10 0x00000000009d7925 in execute_ex (ex=0x7fffede13030) at
/home/kelunik/.php-build/release/Zend/zend_vm_execute.h:429
#11 0x00000000009d7a06 in zend_execute (op_array=0x7fffede7a300,
return_value=0x0) at
/home/kelunik/.php-build/release/Zend/zend_vm_execute.h:474
#12 0x0000000000977583 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/kelunik/.php-build/release/Zend/zend.c:1543
#13 0x00000000008e7ed2 in php_execute_script
(primary_file=0x7fffffffc8a0) at
/home/kelunik/.php-build/release/main/main.c:2552
#14 0x0000000000a5c1db in do_cli (argc=3, argv=0x157db50) at
/home/kelunik/.php-build/release/sapi/cli/php_cli.c:997
#15 0x0000000000a5d25b in main (argc=3, argv=0x157db50) at
/home/kelunik/.php-build/release/sapi/cli/php_cli.c:1390
--
Edit bug report at https://bugs.php.net/bug.php?id=74071&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74071&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74071&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74071&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74071&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74071&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74071&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74071&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74071&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74071&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74071&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74071&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74071&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74071&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74071&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74071&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74071&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74071&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74071&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74071&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74071&r=mysqlcfg