colder                                   Fri, 12 Aug 2011 22:05:10 +0000

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

Log:
Fix CID 538/539, explicitely check for something that should never occur

Changed paths:
    U   php/php-src/branches/PHP_5_4/ext/spl/spl_array.c
    U   php/php-src/trunk/ext/spl/spl_array.c

Modified: php/php-src/branches/PHP_5_4/ext/spl/spl_array.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/spl/spl_array.c    2011-08-12 21:57:54 UTC 
(rev 314853)
+++ php/php-src/branches/PHP_5_4/ext/spl/spl_array.c    2011-08-12 22:05:10 UTC 
(rev 314854)
@@ -322,8 +322,11 @@
                                zval *value;
                                ALLOC_INIT_ZVAL(value);
                                zend_symtable_update(ht, Z_STRVAL_P(offset), 
Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL);
-                               zend_symtable_find(ht, Z_STRVAL_P(offset), 
Z_STRLEN_P(offset)+1, (void **) &retval);
-                               return retval;
+                               if (zend_symtable_find(ht, Z_STRVAL_P(offset), 
Z_STRLEN_P(offset)+1, (void **) &retval) != FAILURE) {
+                                       return retval;
+                               } else {
+                                       return &EG(uninitialized_zval_ptr);
+                               }
                        } else {
                                zend_error(E_NOTICE, "Undefined index:  %s", 
Z_STRVAL_P(offset));
                                return &EG(uninitialized_zval_ptr);
@@ -345,8 +348,11 @@
                                zval *value;
                                ALLOC_INIT_ZVAL(value);
                                zend_hash_index_update(ht, index, 
(void**)&value, sizeof(void*), NULL);
-                               zend_hash_index_find(ht, index, (void **) 
&retval);
-                               return retval;
+                               if (zend_hash_index_find(ht, index, (void **) 
&retval) != FAILURE) {
+                                       return retval;
+                               } else {
+                                       return &EG(uninitialized_zval_ptr);
+                               }
                        } else {
                                zend_error(E_NOTICE, "Undefined offset:  %ld", 
index);
                                return &EG(uninitialized_zval_ptr);

Modified: php/php-src/trunk/ext/spl/spl_array.c
===================================================================
--- php/php-src/trunk/ext/spl/spl_array.c       2011-08-12 21:57:54 UTC (rev 
314853)
+++ php/php-src/trunk/ext/spl/spl_array.c       2011-08-12 22:05:10 UTC (rev 
314854)
@@ -322,8 +322,11 @@
                                zval *value;
                                ALLOC_INIT_ZVAL(value);
                                zend_symtable_update(ht, Z_STRVAL_P(offset), 
Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL);
-                               zend_symtable_find(ht, Z_STRVAL_P(offset), 
Z_STRLEN_P(offset)+1, (void **) &retval);
-                               return retval;
+                               if (zend_symtable_find(ht, Z_STRVAL_P(offset), 
Z_STRLEN_P(offset)+1, (void **) &retval) != FAILURE) {
+                                       return retval;
+                               } else {
+                                       return &EG(uninitialized_zval_ptr);
+                               }
                        } else {
                                zend_error(E_NOTICE, "Undefined index:  %s", 
Z_STRVAL_P(offset));
                                return &EG(uninitialized_zval_ptr);
@@ -345,8 +348,11 @@
                                zval *value;
                                ALLOC_INIT_ZVAL(value);
                                zend_hash_index_update(ht, index, 
(void**)&value, sizeof(void*), NULL);
-                               zend_hash_index_find(ht, index, (void **) 
&retval);
-                               return retval;
+                               if (zend_hash_index_find(ht, index, (void **) 
&retval) != FAILURE) {
+                                       return retval;
+                               } else {
+                                       return &EG(uninitialized_zval_ptr);
+                               }
                        } else {
                                zend_error(E_NOTICE, "Undefined offset:  %ld", 
index);
                                return &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