Bug #67874 [Asn->Csd]: Crash in array_map()

From: Date: Wed, 20 Aug 2014 18:07:03 +0000
Subject: Bug #67874 [Asn->Csd]: Crash in array_map()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187207@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67874&edit=1 ID: 67874 Updated by: dmitry@php.net Reported by: dmitry@php.net Summary: Crash in array_map() -Status: Assigned +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: * PHP Version: master-Git-2014-08-20 (Git) Assigned To: dmitry Block user comment: N Private report: N New Comment: Automatic comment on behalf of dmitry@zend.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=cf09bc7825fc38a49b878beb9e73093aa0b7cf7e Log: Fixed bug #67874 (Crash in array_map()) Previous Comments: ------------------------------------------------------------------------ [2014-08-20 17:38:14] dmitry@php.net Description: ------------ The following script makes use after free that may lead to crash. Test script: --------------- <?php $a = array(1,2,3); $data = array($a); $data = array_map('current', $data); var_dump($data); ?> Expected result: ---------------- array(1) { [0]=> int(1) } Actual result: -------------- ==10659== Invalid read of size 4 ==10659== at 0x867F392: zval_delref_p (zend.h:422) ==10659== by 0x867F4F9: i_zval_ptr_dtor (zend_execute.h:57) ==10659== by 0x868062B: _zval_ptr_dtor (zend_execute_API.c:492) ==10659== by 0x8692889: _zval_ptr_dtor_wrapper (zend_variables.c:296) ==10659== by 0x86A4B9B: zend_hash_destroy (zend_hash.c:900) ==10659== by 0x86920A1: _zval_dtor_func (zend_variables.c:48) ==10659== by 0x86CEDDA: zend_assign_to_variable (zend_execute.c:944) ==10659== by 0x87262E6: ZEND_ASSIGN_SPEC_CV_VAR_HANDLER (zend_vm_execute.h:37258) ==10659== by 0x86D131C: execute_ex (zend_vm_execute.h:354) ==10659== by 0x86D1405: zend_execute (zend_vm_execute.h:383) ==10659== by 0x8695554: zend_execute_scripts (zend.c:1319) ==10659== by 0x861797E: php_execute_script (main.c:2564) ==10659== Address 0x6c54968 is 0 bytes inside a block of size 24 free'd ==10659== at 0x4007B21: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==10659== by 0x8663C8C: _efree (zend_alloc.c:2448) ==10659== by 0x869239D: _zval_dtor_func_for_ptr (zend_variables.c:139) ==10659== by 0x867F547: i_zval_ptr_dtor (zend_execute.h:59) ==10659== by 0x868062B: _zval_ptr_dtor (zend_execute_API.c:492) ==10659== by 0x84E5ECA: zif_array_map (array.c:4473) ==10659== by 0x86D1BE4: ZEND_DO_FCALL_SPEC_HANDLER (zend_vm_execute.h:595) ==10659== by 0x86D131C: execute_ex (zend_vm_execute.h:354) ==10659== by 0x86D1405: zend_execute (zend_vm_execute.h:383) ==10659== by 0x8695554: zend_execute_scripts (zend.c:1319) ==10659== by 0x861797E: php_execute_script (main.c:2564) ==10659== by 0x87301D0: do_cli (php_cli.c:980) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67874&edit=1

« previous php.bugs (#187207) next »