cvs: ZendEngine2(PHP_5_3) / zend_compile.c
[email protected] ("Stanislav Malyshev")
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvsstas1226449401@cvsserver> |
stas Wed Nov 12 00:23:21 2008 UTC
Modified files: (Branch: PHP_5_3)
/ZendEngine2 zend_compile.c
Log:
fix crash - using old opline after realloc
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.90&r2=1.647.2.27.2.41.2.91&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.90 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.91
--- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.90 Wed Nov 12 00:10:24 2008
+++ ZendEngine2/zend_compile.c Wed Nov 12 00:23:21 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.90 2008/11/12 00:10:24 iliaa Exp $ */
+/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.91 2008/11/12 00:23:21 stas Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -1629,6 +1629,7 @@
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
if (ns_call) {
char *slash;
+ int prefix_len, name_len;
/* In run-time PHP will check for function with full name and
internal function with short name */
opline->opcode = ZEND_INIT_NS_FCALL_BY_NAME;
@@ -1639,18 +1640,20 @@
Z_STRVAL(opline->op1.u.constant) = zend_str_tolower_dup(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant));
Z_STRLEN(opline->op1.u.constant) = Z_STRLEN(opline->op2.u.constant);
opline->extended_value = zend_hash_func(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant) + 1);
+ slash = zend_memrchr(Z_STRVAL(opline->op1.u.constant), '\\', Z_STRLEN(opline->op1.u.constant));
+ prefix_len = slash-Z_STRVAL(opline->op1.u.constant)+1;
+ name_len = Z_STRLEN(opline->op1.u.constant)-prefix_len;
opline2 = get_next_op(CG(active_op_array) TSRMLS_CC);
opline2->opcode = ZEND_OP_DATA;
opline2->op1.op_type = IS_CONST;
Z_TYPE(opline2->op1.u.constant) = IS_LONG;
- slash = zend_memrchr(Z_STRVAL(opline->op1.u.constant), '\\', Z_STRLEN(opline->op1.u.constant));
if(!slash) {
zend_error(E_CORE_ERROR, "Namespaced name %s should contain slash", Z_STRVAL(opline->op1.u.constant));
}
/* this is the length of namespace prefix */
- Z_LVAL(opline2->op1.u.constant) = slash-Z_STRVAL(opline->op1.u.constant)+1;
+ Z_LVAL(opline2->op1.u.constant) = prefix_len;
/* this is the hash of the non-prefixed part, lowercased */
- opline2->extended_value = zend_hash_func(slash+1, Z_STRLEN(opline->op1.u.constant)-Z_LVAL(opline2->op1.u.constant)+1);
+ opline2->extended_value = zend_hash_func(slash+1, name_len+1);
} else {
opline->opcode = ZEND_INIT_FCALL_BY_NAME;
opline->op2 = *function_name;