]> granicus.if.org Git - php/commitdiff
fix hashtable creation for zip to be exact size needed, fix endian issue for loading...
authorGreg Beaver <cellog@php.net>
Mon, 16 Jun 2008 04:06:59 +0000 (04:06 +0000)
committerGreg Beaver <cellog@php.net>
Mon, 16 Jun 2008 04:06:59 +0000 (04:06 +0000)
ext/phar/zip.c

index c36f2a70cc02cf0892bd042c254921ee3a6b9cb1..3932c7c9af13500f950cb6733a81b7ae4e6cf7a9 100644 (file)
@@ -254,11 +254,11 @@ foundit:
        /* seek to central directory */
        php_stream_seek(fp, PHAR_GET_32(locator.cdir_offset), SEEK_SET);
        /* read in central directory */
-       zend_hash_init(&mydata->manifest, sizeof(phar_entry_info),
+       zend_hash_init(&mydata->manifest, PHAR_GET_16(locator.count),
                zend_get_hash_value, destroy_phar_manifest_entry, mydata->is_persistent);
-       zend_hash_init(&mydata->mounted_dirs, sizeof(char *),
+       zend_hash_init(&mydata->mounted_dirs, 5,
                zend_get_hash_value, NULL, mydata->is_persistent);
-       zend_hash_init(&mydata->virtual_dirs, sizeof(char *),
+       zend_hash_init(&mydata->virtual_dirs, PHAR_GET_16(locator.count) * 2,
                zend_get_hash_value, NULL, mydata->is_persistent);
        entry.phar = mydata;
        entry.is_zip = 1;
@@ -286,7 +286,7 @@ foundit:
                        return FAILURE;
 
        /* add each central directory item to the manifest */
-       for (i = 0; i < locator.count; ++i) {
+       for (i = 0; i < PHAR_GET_16(locator.count); ++i) {
                phar_zip_central_dir_file zipentry;
 
                if (sizeof(zipentry) != php_stream_read(fp, (char *) &zipentry, sizeof(zipentry))) {