Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Invalid memory access in Phalcon\Config\Adapter\Ini #861

Closed
ghost opened this issue Jul 17, 2013 · 3 comments
Closed

[BUG] Invalid memory access in Phalcon\Config\Adapter\Ini #861

ghost opened this issue Jul 17, 2013 · 3 comments

Comments

@ghost
Copy link

ghost commented Jul 17, 2013

==13345== Invalid read of size 4
==13345==    at 0xAABA74: _zval_ptr_dtor (zend.h:385)
==13345==    by 0xABD770: _zval_ptr_dtor_wrapper (zend_variables.c:191)
==13345==    by 0xAD40E4: zend_hash_destroy (zend_hash.c:529)
==13345==    by 0xABD22A: _zval_dtor_func (zend_variables.c:45)
==13345==    by 0xAA96B2: _zval_dtor (zend_variables.h:35)
==13345==    by 0xAABB14: _zval_ptr_dtor (zend_execute_API.c:447)
==13345==    by 0x11551820: phalcon_memory_restore_stack (memory.c:196)
==13345==    by 0x116EC42F: zim_Phalcon_Config_Adapter_Ini___construct (ini.c:180)
==13345==    by 0xB0069E: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:322)
==13345==    by 0xB01111: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:428)
==13345==    by 0xAFF5AF: execute (zend_vm_execute.h:107)
==13345==    by 0xAC232C: zend_execute_scripts (zend.c:1259)
==13345==  Address 0x19e1d600 is 16 bytes inside a block of size 32 free'd
==13345==    at 0x4C2BA6C: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==13345==    by 0xA8F610: _efree (zend_alloc.c:2358)
==13345==    by 0xAABB34: _zval_ptr_dtor (zend_execute_API.c:448)
==13345==    by 0xABD770: _zval_ptr_dtor_wrapper (zend_variables.c:191)
==13345==    by 0xAD40E4: zend_hash_destroy (zend_hash.c:529)
==13345==    by 0xABD22A: _zval_dtor_func (zend_variables.c:45)
==13345==    by 0xAA96B2: _zval_dtor (zend_variables.h:35)
==13345==    by 0xAABB14: _zval_ptr_dtor (zend_execute_API.c:447)
==13345==    by 0x11551820: phalcon_memory_restore_stack (memory.c:196)
==13345==    by 0x116EC42F: zim_Phalcon_Config_Adapter_Ini___construct (ini.c:180)
==13345==    by 0xB0069E: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:322)
==13345==    by 0xB01111: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:428)
==13345== 
==13345== Invalid write of size 4
==13345==    at 0xAABA7E: _zval_ptr_dtor (zend.h:385)
==13345==    by 0xABD770: _zval_ptr_dtor_wrapper (zend_variables.c:191)
==13345==    by 0xAD40E4: zend_hash_destroy (zend_hash.c:529)
==13345==    by 0xABD22A: _zval_dtor_func (zend_variables.c:45)
==13345==    by 0xAA96B2: _zval_dtor (zend_variables.h:35)
==13345==    by 0xAABB14: _zval_ptr_dtor (zend_execute_API.c:447)
==13345==    by 0x11551820: phalcon_memory_restore_stack (memory.c:196)
==13345==    by 0x116EC42F: zim_Phalcon_Config_Adapter_Ini___construct (ini.c:180)
==13345==    by 0xB0069E: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:322)
==13345==    by 0xB01111: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:428)
==13345==    by 0xAFF5AF: execute (zend_vm_execute.h:107)
==13345==    by 0xAC232C: zend_execute_scripts (zend.c:1259)
==13345==  Address 0x19e1d600 is 16 bytes inside a block of size 32 free'd
==13345==    at 0x4C2BA6C: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==13345==    by 0xA8F610: _efree (zend_alloc.c:2358)
==13345==    by 0xAABB34: _zval_ptr_dtor (zend_execute_API.c:448)
==13345==    by 0xABD770: _zval_ptr_dtor_wrapper (zend_variables.c:191)
==13345==    by 0xAD40E4: zend_hash_destroy (zend_hash.c:529)
==13345==    by 0xABD22A: _zval_dtor_func (zend_variables.c:45)
==13345==    by 0xAA96B2: _zval_dtor (zend_variables.h:35)
==13345==    by 0xAABB14: _zval_ptr_dtor (zend_execute_API.c:447)
==13345==    by 0x11551820: phalcon_memory_restore_stack (memory.c:196)
==13345==    by 0x116EC42F: zim_Phalcon_Config_Adapter_Ini___construct (ini.c:180)
==13345==    by 0xB0069E: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:322)
==13345==    by 0xB01111: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:428)
@ghost
Copy link
Author

ghost commented Jul 17, 2013

        if (zend_hash_num_elements(ah1) == 0) {
            phalcon_array_update_zval(&config, section, &directives, 0);
            zend_hash_move_forward_ex(ah0, &hp0);
            continue;
        }

phalcon_array_update_zval(&config, section, &directives, 0) triggers the bug.

@ghost
Copy link
Author

ghost commented Jul 17, 2013

Stupid bug, missing Z_ADDREF_P

@ghost
Copy link
Author

ghost commented Jul 17, 2013

Fixed in 7c441ea

@ghost ghost closed this as completed Jul 17, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants