Bug #70156 [NEW]: Segfault in ReflectionClass->getMethods() with trait aliases

From: Date: Tue, 28 Jul 2015 08:25:05 +0000
Subject: Bug #70156 [NEW]: Segfault in ReflectionClass->getMethods() with trait aliases
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194769@lists.php.net to get a copy of this message
From:             lbarnaud@php.net
Operating system: 
PHP version:      7.0.0beta2
Package:          Reflection related
Bug Type:         Bug
Bug description:Segfault in ReflectionClass->getMethods() with trait aliases

Description:
------------
ReflectionClass->getMethods() can crash in the presence of traits and
aliased methods

Test script:
---------------
https://gist.github.com/arnaud-lb/b86c8d989877270a7643
(this is a
minimal reduction of
https://github.com/cebe/markdown/blob/208be0fbf2c097e84daa741e76d66870a9e3a5c7/Markdown.php#L15
)

Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
0x000000000086e985 in zend_find_alias_name (ce=0x7ffff60045a8,
name=0x7ffff607b140) at /php-src/Zend/zend_API.c:4109
4109                if (ZSTR_LEN(alias->alias) == ZSTR_LEN(name) &&
(gdb) bt
#0  0x000000000086e985 in zend_find_alias_name (ce=0x7ffff60045a8,
name=0x7ffff607b140) at /php-src/Zend/zend_API.c:4109
#1  0x000000000086eb4c in zend_resolve_method_name (ce=0x7ffff60045a8,
f=0x7ffff6004940) at /php-src/Zend/zend_API.c:4145
#2  0x00000000006845cb in reflection_method_factory (ce=0x7ffff60045a8,
method=0x7ffff6004940, closure_object=0x0, object=0x7fffffffaf80)
    at /php-src/ext/reflection/php_reflection.c:1306
#3  0x000000000068ec30 in _addmethod (mptr=0x7ffff6004940,
ce=0x7ffff60045a8, retval=0x7ffff60151a0, filter=512, obj=0x0)
    at /php-src/ext/reflection/php_reflection.c:4147
#4  0x000000000068edbd in _addmethod_va (el=0x7ffff6061e20, num_args=4,
args=0x7fffffffb040, hash_key=0x7fffffffb030)
    at /php-src/ext/reflection/php_reflection.c:4162
#5  0x000000000087425c in zend_hash_apply_with_arguments
(ht=0x7ffff60045e8, apply_func=0x68ec45 <_addmethod_va>, num_args=4)
    at /php-src/Zend/zend_hash.c:1496
#6  0x000000000068ef76 in zim_reflection_class_getMethods
(execute_data=0x7ffff60151c0, return_value=0x7ffff60151a0)
    at /php-src/ext/reflection/php_reflection.c:4189
#7  0x00000000008b8ec0 in ZEND_DO_FCALL_SPEC_HANDLER
(execute_data=0x7ffff60150e0) at /php-src/Zend/zend_vm_execute.h:835
#8  0x00000000008b7cf1 in execute_ex (ex=0x7ffff6015030) at
/php-src/Zend/zend_vm_execute.h:409
#9  0x00000000008b7e1b in zend_execute (op_array=0x7ffff607c000,
return_value=0x0) at /php-src/Zend/zend_vm_execute.h:450
#10 0x000000000085eac6 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /php-src/Zend/zend.c:1399
#11 0x00000000007cef8b in php_execute_script
(primary_file=0x7fffffffe790) at /php-src/main/main.c:2475
#12 0x0000000000922c4d in do_cli (argc=2, argv=0x10c3550) at
/php-src/sapi/cli/php_cli.c:971
#13 0x0000000000923c22 in main (argc=2, argv=0x10c3550) at
/php-src/sapi/cli/php_cli.c:1338

-- 
Edit bug report at https://bugs.php.net/bug.php?id=70156&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=70156&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=70156&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=70156&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=70156&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=70156&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=70156&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=70156&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=70156&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=70156&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=70156&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=70156&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=70156&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=70156&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70156&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=70156&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=70156&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=70156&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70156&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=70156&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=70156&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#194769) next »