stas                                     Wed, 16 Mar 2011 05:41:50 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=309266

Log:
fix UMR when setting forward string offset

Changed paths:
    U   php/php-src/trunk/Zend/zend_execute.c

Modified: php/php-src/trunk/Zend/zend_execute.c
===================================================================
--- php/php-src/trunk/Zend/zend_execute.c       2011-03-16 05:25:02 UTC (rev 
309265)
+++ php/php-src/trunk/Zend/zend_execute.c       2011-03-16 05:41:50 UTC (rev 
309266)
@@ -671,7 +671,7 @@
                        return;
                }
        }
-
+
        /* separate our value if necessary */
        if (value_type == IS_TMP_VAR) {
                zval *orig_value = value;
@@ -737,7 +737,7 @@
                        if (IS_INTERNED(Z_STRVAL_P(T->str_offset.str))) {
                                char *tmp = (char *) 
emalloc(T->str_offset.offset+1+1);

-                               memcpy(tmp, Z_STRVAL_P(T->str_offset.str), 
T->str_offset.offset+1+1);
+                               memcpy(tmp, Z_STRVAL_P(T->str_offset.str), 
Z_STRLEN_P(T->str_offset.str)+1);
                                Z_STRVAL_P(T->str_offset.str) = tmp;
                        } else {
                                Z_STRVAL_P(T->str_offset.str) = (char *) 
erealloc(Z_STRVAL_P(T->str_offset.str), T->str_offset.offset+1+1);
@@ -756,7 +756,7 @@

                if (Z_TYPE_P(value) != IS_STRING) {
                        zval tmp;
-
+
                        ZVAL_COPY_VALUE(&tmp, value);
                        if (value_type != IS_TMP_VAR) {
                                zval_copy_ctor(&tmp);
@@ -979,7 +979,7 @@
                        goto fetch_string_dim;

                case IS_STRING:
-
+
                        offset_key = dim->value.str.val;
                        offset_key_length = dim->value.str.len;

@@ -992,7 +992,7 @@
                                } else {
                                        hval = zend_hash_func(offset_key, 
offset_key_length+1);
                                }
-                       }
+                       }
 fetch_string_dim:
                        if (zend_hash_quick_find(ht, offset_key, 
offset_key_length+1, hval, (void **) &retval) == FAILURE) {
                                switch (type) {
@@ -1267,7 +1267,7 @@
                                        Z_STRVAL_P(ptr) = (char*)emalloc(2);
                                        Z_STRVAL_P(ptr)[0] = 
Z_STRVAL_P(container)[Z_LVAL_P(dim)];
                                        Z_STRVAL_P(ptr)[1] = 0;
-                                       Z_STRLEN_P(ptr) = 1;
+                                       Z_STRLEN_P(ptr) = 1;
                                }
                                AI_SET_PTR(result, ptr);
                                return;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to