Bug #71303 [NEW]: Segfault in zend_assign_concat due to E_NOTICE

From: Date: Thu, 07 Jan 2016 14:58:22 +0000
Subject: Bug #71303 [NEW]: Segfault in zend_assign_concat due to E_NOTICE
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198492@lists.php.net to get a copy of this message
From:             laruence
Operating system: 
PHP version:      7.0.2
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Segfault in zend_assign_concat due to E_NOTICE

Description:
------------
E_NOTICE maybe result in symbol table resize, which will result in
segfault

Test script:
---------------
function test() {
    for ($n = 'a'; $n < 'g'; $n++) {
        $$n = array();
    }
    $$n = array();
    $$n .= "test";
    return $$n;
}   


var_dump(test2());

Expected result:
----------------
no segfault

Actual result:
--------------
segfault 

valgrind:
PHP Notice:  Array to string conversion in /tmp/1.php on line 15

Notice: Array to string conversion in /tmp/1.php on line 15
==12029== Invalid read of size 1
==12029==    at 0x984238: _zval_dtor (zend_variables.h:41)
==12029==    by 0x98CF70: concat_function (zend_operators.c:1611)
==12029==    by 0xA137FD: zend_binary_assign_op_helper_SPEC_VAR_CONST
(zend_vm_execute.h:16581)
==12029==    by 0xA13B7D: ZEND_ASSIGN_CONCAT_SPEC_VAR_CONST_HANDLER
(zend_vm_execute.h:16739)
==12029==    by 0x9F0BB4: execute_ex (zend_vm_execute.h:414)
==12029==    by 0x9F0CC6: zend_execute (zend_vm_execute.h:458)
==12029==    by 0x995C1E: zend_execute_scripts (zend.c:1427)
==12029==    by 0x902F01: php_execute_script (main.c:2484)
==12029==    by 0xA55028: do_cli (php_cli.c:974)
==12029==    by 0xA561EC: main (php_cli.c:1345)
==12029==  Address 0xb722de9 is 265 bytes inside a block of size 288
free'd
==12029==    at 0x4C2BDEC: free (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12029==    by 0x9624DE: _efree (zend_alloc.c:2453)
==12029==    by 0x9A9251: zend_hash_do_resize (zend_hash.c:880)
==12029==    by 0x9A81E9: _zend_hash_add_or_update_i (zend_hash.c:591)
==12029==    by 0x9A85F0: _zend_hash_str_update_ind (zend_hash.c:662)
==12029==    by 0x9807BF: zend_set_local_var_str
(zend_execute_API.c:1653)
==12029==    by 0x9004C7: php_error_cb (main.c:1203)
==12029==    by 0x7547C5: soap_error_handler (soap.c:2139)
==12029==    by 0x994CEB: zend_error (zend.c:1154)
==12029==    by 0x986E11: _zval_get_string_func (zend_operators.c:834)
==12029==    by 0x9934F2: zend_make_printable_zval (zend.c:249)
==12029==    by 0x98CF45: concat_function (zend_operators.c:1605)



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



Thread (2 messages)

« previous php.bugs (#198492) next »