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] Phalcon\Config crashes on recursive arrays #1504

Closed
ghost opened this issue Nov 1, 2013 · 0 comments
Closed

[BUG] Phalcon\Config crashes on recursive arrays #1504

ghost opened this issue Nov 1, 2013 · 0 comments

Comments

@ghost
Copy link

ghost commented Nov 1, 2013

Test case:

<?php
$a = array();
$a['a'] = &$a;
$c = new \Phalcon\Config($a);
Program terminated with signal 11, Segmentation fault.
#0  0x00000000009e3bca in zend_mm_high_bit (_size=<error reading variable: Cannot access memory at address 0x7fffaad2eff8>) at /tmp/php-build/source/5.5.4/Zend/zend_alloc.c:666
666     /tmp/php-build/source/5.5.4/Zend/zend_alloc.c: Немає такого файла або каталогу.
(gdb) bt
#0  0x00000000009e3bca in zend_mm_high_bit (_size=<error reading variable: Cannot access memory at address 0x7fffaad2eff8>) at /tmp/php-build/source/5.5.4/Zend/zend_alloc.c:666
#1  0x00000000009e66bd in zend_mm_search_large_block (heap=0x2769170, true_size=136) at /tmp/php-build/source/5.5.4/Zend/zend_alloc.c:1810
#2  0x00000000009e6bf9 in _zend_mm_alloc_int (heap=0x2769170, size=40, __zend_filename=0x7fab95aec808 "/home/vladimir/workspace/cphalcon/ext/config.c", __zend_lineno=328, 
    __zend_orig_filename=0xf9d6b8 "/tmp/php-build/source/5.5.4/Zend/zend_alloc.c", __zend_orig_lineno=2583) at /tmp/php-build/source/5.5.4/Zend/zend_alloc.c:1938
#3  0x00000000009e89bf in _emalloc (size=40, __zend_filename=0x7fab95aec808 "/home/vladimir/workspace/cphalcon/ext/config.c", __zend_lineno=328, __zend_orig_filename=0xf9d6b8 "/tmp/php-build/source/5.5.4/Zend/zend_alloc.c", 
    __zend_orig_lineno=2583) at /tmp/php-build/source/5.5.4/Zend/zend_alloc.c:2429
#4  0x00000000009e8cea in _safe_emalloc (nmemb=1, size=40, offset=0, __zend_filename=0x7fab95aec808 "/home/vladimir/workspace/cphalcon/ext/config.c", __zend_lineno=328, __zend_orig_filename=0x0, __zend_orig_lineno=0)
    at /tmp/php-build/source/5.5.4/Zend/zend_alloc.c:2583
#5  0x00000000009e8e35 in _ecalloc (nmemb=1, size=40, __zend_filename=0x7fab95aec808 "/home/vladimir/workspace/cphalcon/ext/config.c", __zend_lineno=328, __zend_orig_filename=0x0, __zend_orig_lineno=0)
    at /tmp/php-build/source/5.5.4/Zend/zend_alloc.c:2610
#6  0x00007fab95607930 in phalcon_config_object_ctor (ce=0x2a7d850, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:328
#7  0x0000000000a347d9 in _object_and_properties_init (arg=0x7fab8d37e9d0, class_type=0x2a7d850, properties=0x0, __zend_filename=0x7fab95aec808 "/home/vladimir/workspace/cphalcon/ext/config.c", __zend_lineno=155, tsrm_ls=0x2766a70)
    at /tmp/php-build/source/5.5.4/Zend/zend_API.c:1200
#8  0x0000000000a34834 in _object_init_ex (arg=0x7fab8d37e9d0, class_type=0x2a7d850, __zend_filename=0x7fab95aec808 "/home/vladimir/workspace/cphalcon/ext/config.c", __zend_lineno=155, tsrm_ls=0x2766a70)
    at /tmp/php-build/source/5.5.4/Zend/zend_API.c:1208
#9  0x00007fab95607352 in phalcon_config_write_internal (object=0x7fab8d37e8a0, offset=0x7fffaad2f3d0, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:155
#10 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37e820, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#11 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37e6f0, offset=0x7fffaad2f480, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#12 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37e670, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#13 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37e540, offset=0x7fffaad2f530, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#14 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37e4c0, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#15 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37e390, offset=0x7fffaad2f5e0, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#16 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37e310, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#17 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37e1e0, offset=0x7fffaad2f690, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#18 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37e160, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#19 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37e030, offset=0x7fffaad2f740, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#20 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37dfb0, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#21 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37de80, offset=0x7fffaad2f7f0, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#22 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37de00, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#23 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37dcd0, offset=0x7fffaad2f8a0, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#24 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37dc50, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#25 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37db20, offset=0x7fffaad2f950, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#26 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37daa0, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#27 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37d970, offset=0x7fffaad2fa00, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#28 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37d8f0, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#29 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37d7c0, offset=0x7fffaad2fab0, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#30 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37d740, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#31 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37d610, offset=0x7fffaad2fb60, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#32 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37d590, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#33 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37d460, offset=0x7fffaad2fc10, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#34 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37d3e0, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#35 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37d2b0, offset=0x7fffaad2fcc0, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#36 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37d230, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#37 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37d100, offset=0x7fffaad2fd70, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#38 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37d080, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#39 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37cf50, offset=0x7fffaad2fe20, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#40 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37ced0, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#41 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37cda0, offset=0x7fffaad2fed0, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#42 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37cd20, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#43 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37cbf0, offset=0x7fffaad2ff80, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#44 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37cb70, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#45 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37ca40, offset=0x7fffaad30030, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#46 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37c9c0, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#47 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37c890, offset=0x7fffaad300e0, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#48 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37c810, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#49 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37c6e0, offset=0x7fffaad30190, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#50 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37c660, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413
#51 0x00007fab95607369 in phalcon_config_write_internal (object=0x7fab8d37c530, offset=0x7fffaad30240, value=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:156
#52 0x00007fab95607edc in phalcon_config_construct_internal (this_ptr=0x7fab8d37c4b0, array_config=0x7faba45a6f68, tsrm_ls=0x2766a70) at /home/vladimir/workspace/cphalcon/ext/config.c:413

The crash happens due to stack overflow.

@ghost ghost mentioned this issue Nov 2, 2013
phalcon pushed a commit that referenced this issue Nov 3, 2013
@phalcon phalcon closed this as completed Nov 3, 2013
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