felipe                                   Sun, 05 Jun 2011 01:38:12 +0000

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

Log:
- Possible fix for bug #54609 (Certain implementation(s) of SplFixedArray cause 
hard crash)

Bug: http://bugs.php.net/54609 (Open) Certain implementation(s) of 
SplFixedArray cause hard crash
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/spl/spl_fixedarray.c
    U   php/php-src/branches/PHP_5_4/ext/spl/spl_fixedarray.c
    U   php/php-src/trunk/ext/spl/spl_fixedarray.c

Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_fixedarray.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/spl/spl_fixedarray.c       2011-06-05 
01:15:10 UTC (rev 311816)
+++ php/php-src/branches/PHP_5_3/ext/spl/spl_fixedarray.c       2011-06-05 
01:38:12 UTC (rev 311817)
@@ -152,7 +152,7 @@
        spl_fixedarray_object *intern  = 
(spl_fixedarray_object*)zend_object_store_get_object(obj TSRMLS_CC);
        int  i = 0;

-       if (intern->array) {
+       if (intern->array && !GC_G(gc_active)) {
                int j = zend_hash_num_elements(intern->std.properties);

                for (i = 0; i < intern->array->size; i++) {
@@ -160,9 +160,6 @@
                                zend_hash_index_update(intern->std.properties, 
i, (void *)&intern->array->elements[i], sizeof(zval *), NULL);
                                Z_ADDREF_P(intern->array->elements[i]);
                        } else {
-                               if (GC_G(gc_active)) {
-                                       return NULL;
-                               }
                                zend_hash_index_update(intern->std.properties, 
i, (void *)&EG(uninitialized_zval_ptr), sizeof(zval *), NULL);
                                Z_ADDREF_P(EG(uninitialized_zval_ptr));
                        }

Modified: php/php-src/branches/PHP_5_4/ext/spl/spl_fixedarray.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/spl/spl_fixedarray.c       2011-06-05 
01:15:10 UTC (rev 311816)
+++ php/php-src/branches/PHP_5_4/ext/spl/spl_fixedarray.c       2011-06-05 
01:38:12 UTC (rev 311817)
@@ -153,7 +153,7 @@
        HashTable *ht = zend_std_get_properties(obj TSRMLS_CC);
        int  i = 0;

-       if (intern->array) {
+       if (intern->array && !GC_G(gc_active)) {
                int j = zend_hash_num_elements(ht);

                for (i = 0; i < intern->array->size; i++) {
@@ -161,9 +161,6 @@
                                zend_hash_index_update(ht, i, (void 
*)&intern->array->elements[i], sizeof(zval *), NULL);
                                Z_ADDREF_P(intern->array->elements[i]);
                        } else {
-                               if (GC_G(gc_active)) {
-                                       return NULL;
-                               }
                                zend_hash_index_update(ht, i, (void 
*)&EG(uninitialized_zval_ptr), sizeof(zval *), NULL);
                                Z_ADDREF_P(EG(uninitialized_zval_ptr));
                        }

Modified: php/php-src/trunk/ext/spl/spl_fixedarray.c
===================================================================
--- php/php-src/trunk/ext/spl/spl_fixedarray.c  2011-06-05 01:15:10 UTC (rev 
311816)
+++ php/php-src/trunk/ext/spl/spl_fixedarray.c  2011-06-05 01:38:12 UTC (rev 
311817)
@@ -153,7 +153,7 @@
        HashTable *ht = zend_std_get_properties(obj TSRMLS_CC);
        int  i = 0;

-       if (intern->array) {
+       if (intern->array && !GC_G(gc_active)) {
                int j = zend_hash_num_elements(ht);

                for (i = 0; i < intern->array->size; i++) {
@@ -161,9 +161,6 @@
                                zend_hash_index_update(ht, i, (void 
*)&intern->array->elements[i], sizeof(zval *), NULL);
                                Z_ADDREF_P(intern->array->elements[i]);
                        } else {
-                               if (GC_G(gc_active)) {
-                                       return NULL;
-                               }
                                zend_hash_index_update(ht, i, (void 
*)&EG(uninitialized_zval_ptr), sizeof(zval *), NULL);
                                Z_ADDREF_P(EG(uninitialized_zval_ptr));
                        }

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

Reply via email to