]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.6' into PHP-7.0
authorStanislav Malyshev <stas@php.net>
Tue, 29 Sep 2015 03:45:02 +0000 (20:45 -0700)
committerStanislav Malyshev <stas@php.net>
Tue, 29 Sep 2015 03:45:02 +0000 (20:45 -0700)
* PHP-5.6:
  fix memory leak
  FIx bug #70433 - Uninitialized pointer in phar_make_dirstream when zip entry filename is "/"

Conflicts:
ext/phar/dirstream.c

1  2 
ext/phar/dirstream.c
ext/phar/util.c

index 6cb78ad692b2943c1e60cfda077821ed035e9c07,e6926ce1541e43cf2ba275a58f0008f140778cb4..1275c98d66fbf7e00ff7b2fcb617b3721516879a
@@@ -199,7 -198,7 +199,7 @@@ static php_stream *phar_make_dirstream(
        zend_hash_internal_pointer_reset(manifest);
  
        while (FAILURE != zend_hash_has_more_elements(manifest)) {
-               if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key(manifest, &str_key, &unused)) {
 -              if (HASH_KEY_IS_STRING != zend_hash_get_current_key_ex(manifest, &str_key, &keylen, &unused, 0, NULL)) {
++              if (HASH_KEY_IS_STRING != zend_hash_get_current_key(manifest, &str_key, &unused)) {
                        break;
                }
  
diff --cc ext/phar/util.c
index 54a928618bd4b811a684be81e1a3c5c53101f689,461cbf91f124b054da11aa68c1b193e541f06d8d..f2f422ef62cf8db9ddef99152571542b3bd8e072
@@@ -491,15 -492,16 +491,16 @@@ really_get_entry
        (*ret)->internal_file = entry;
        (*ret)->is_zip = entry->is_zip;
        (*ret)->is_tar = entry->is_tar;
 -      (*ret)->fp = phar_get_efp(entry, 1 TSRMLS_CC);
 +      (*ret)->fp = phar_get_efp(entry, 1);
        if (entry->link) {
 -              phar_entry_info *link = phar_get_link_source(entry TSRMLS_CC);
 +              phar_entry_info *link = phar_get_link_source(entry);
                if(!link) {
+                       efree(*ret);
                        return FAILURE;
                }
 -              (*ret)->zero = phar_get_fp_offset(link TSRMLS_CC);
 +              (*ret)->zero = phar_get_fp_offset(link);
        } else {
 -              (*ret)->zero = phar_get_fp_offset(entry TSRMLS_CC);
 +              (*ret)->zero = phar_get_fp_offset(entry);
        }
  
        if (!phar->is_persistent) {