Re: [ZEND-ENGINE-CVS] cvs: Zend / zend_compile.c
| From: | Andi Gutmans | Date: | Fri, 16 Aug 2002 16:21:21 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: Zend / zend_compile.c | ||
| References: | 1 2 3 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-321@lists.php.net to get a copy of this message | ||
You should handle the declare in zend_do_declare_stmt(). At that point the string is still alive.
What are your needs?
Andi
At 07:29 AM 8/14/2002 +0900, Masaki Fujimoto wrote:
executing a following script causes this (when ZEND_MULTIBYTE is defined): <?php declare(encoding=shift_jis); ?> gdb says: [masaki-f@nx] gdb /home/masaki-f/cvs/php4/sapi/cli/php (gdb) b zend_do_declare_stmt Breakpoint 1 at 0x8162200: file /home/masaki-f/cvs/php4/Zend/zend_compile.c, line 2217. (gdb) r ~/sample.php Starting program: /home/masaki-f/cvs/php4/sapi/cli/php ~/sample.php Breakpoint 1, zend_do_declare_stmt (var=0xbfffc910, val=0xbfffc930)at /home/masaki-f/cvs/php4/Zend/zend_compile.c:2217 2217 convert_to_string(&var->u.constant);(gdb) n2219 if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "ticks", sizeof("ticks")-1)) {(gdb)2227 convert_to_string(&val->u.constant);(gdb) disp val->u.constant 1: val->u.constant = {value = {lval = 136542428, dval = 1.9165423041562003e-313, str = {val = 0x82378dc "shift_jis", len = 9}, ht = 0x82378dc, obj = {ce = 0x82378dc, properties = 0x9}},type = 8 '\b', is_ref = 0 '\000', refcount = 1} (gdb) n2228 if (!val->u.constant.value.str.val) { 1: val->u.constant = {value = {lval = 0, dval = 1.9097962118687451e-313, str = {val = 0x0, len = 9}, ht = 0x0, obj = {ce = 0x0, properties = 0x9}}, type = 3 '\003', is_ref = 0 '\000', refcount = 1}convert_to_string seems to end up when the 'type' is unknown (== DEFAULT)... anyway, I now think my patch did not have correct to way to fix the problem, but currently I do not know what is the best way to fix this. Would you please show me the way ? Masaki Fujimoto On Tue, 13 Aug 2002 19:25:23 +0300 Andi Gutmans <andi@zend.com> wrote: This patch doesn't look very good. convert_to_string() shouldn't end up with a null in str.val. It could break lots of things and not only the place you just fixed now. When is this happening? Andi At 06:01 AM 8/13/2002 +0000, Masaki Fujimoto wrote:fujimoto Tue Aug 13 02:01:40 2002 EDTModified files:/Zend zend_compile.cLog: fix segfaults Index: Zend/zend_compile.c diff -u Zend/zend_compile.c:1.234 Zend/zend_compile.c:1.235 --- Zend/zend_compile.c:1.234 Sun Aug 4 02:39:44 2002 +++ Zend/zend_compile.c Tue Aug 13 02:01:40 2002 @@ -2225,8 +2225,10 @@zend_multibyte_filter old_input_filter;convert_to_string(&val->u.constant); + if (!val->u.constant.value.str.val) { + zend_error(E_COMPILE_ERROR, "Invalid encodingspecified (without quotes ?)");+ } new_encoding =zend_multibyte_fetch_encoding(val->u.constant.value.str.val);- efree(val->u.constant.value.str.val); if (!new_encoding) { zend_error(E_COMPILE_WARNING, "Unsupportedencoding [%s]\n", val->u.constant.value.str.val);} else {@@ -2240,6 +2242,7 @@zend_yyinput_again(old_input_filter,old_encoding TSRMLS_CC);} } + efree(val->u.constant.value.str.val);#endif /* ZEND_MULTIBYTE */} zval_dtor(&var->u.constant);-- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php