File php-CVE-2016-7480.patch of Package php7.13659
X-Git-Url: http://72.52.91.13:8000/?p=php-src.git;a=blobdiff_plain;f=ext%2Fspl%2Fspl_observer.c;h=ad7887bd287feafebbf8f163401800d01d790c13;hp=c1892058796455e95f6a53c2305661689a52b7ac;hb=61cdd1255d5b9c8453be71aacbbf682796ac77d4;hpb=1b29e4488e19c89e5b37ecb26acaec443d7f1355
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index c189205..ad7887b 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -772,6 +772,9 @@ SPL_METHOD(SplObjectStorage, unserialize)
--p; /* for ';' */
count = Z_LVAL_P(pcount);
+ ZVAL_UNDEF(&entry);
+ ZVAL_UNDEF(&inf);
+
while (count-- > 0) {
spl_SplObjectStorageElement *pelement;
zend_string *hash;
@@ -787,18 +790,17 @@ SPL_METHOD(SplObjectStorage, unserialize)
if (!php_var_unserialize(&entry, &p, s + buf_len, &var_hash)) {
goto outexcept;
}
- if (Z_TYPE(entry) != IS_OBJECT) {
- zval_ptr_dtor(&entry);
- goto outexcept;
- }
if (*p == ',') { /* new version has inf */
++p;
if (!php_var_unserialize(&inf, &p, s + buf_len, &var_hash)) {
zval_ptr_dtor(&entry);
goto outexcept;
}
- } else {
- ZVAL_UNDEF(&inf);
+ }
+ if (Z_TYPE(entry) != IS_OBJECT) {
+ zval_ptr_dtor(&entry);
+ zval_ptr_dtor(&inf);
+ goto outexcept;
}
hash = spl_object_storage_get_hash(intern, getThis(), &entry);