]> granicus.if.org Git - php/commitdiff
fix terrible logic discovered in windows testing (not sure how it ever worked on...
authorGreg Beaver <cellog@php.net>
Fri, 14 Dec 2007 18:34:12 +0000 (18:34 +0000)
committerGreg Beaver <cellog@php.net>
Fri, 14 Dec 2007 18:34:12 +0000 (18:34 +0000)
ext/phar/phar.c

index fc1d7f5acba53a9575c1a00140c155b64c43aea9..a462a24ebc3d2758cce883ae3467d6d6f487e827 100644 (file)
@@ -1887,7 +1887,7 @@ static phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info
 
                entry->fp = php_stream_temp_new();
                php_stream_filter_append(&entry->fp->writefilters, filter);
-               if (php_stream_copy_to_stream(fp, entry->fp, entry->compressed_filesize) != entry->compressed_filesize && php_stream_tell(fp) != (off_t) entry->uncompressed_filesize) {
+               if (php_stream_copy_to_stream(fp, entry->fp, entry->compressed_filesize) != entry->compressed_filesize || php_stream_tell(entry->fp) != (off_t) entry->uncompressed_filesize) {
                        efree(buffer);
                        spprintf(error, 0, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename);
                        php_stream_filter_remove(filter, 1 TSRMLS_CC);
@@ -1896,14 +1896,6 @@ static phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info
                efree(buffer);
                php_stream_filter_flush(filter, 1);
                php_stream_filter_remove(filter, 1 TSRMLS_CC);
-               if (php_stream_tell(fp) != (off_t)(offset + entry->compressed_filesize)) {
-                       spprintf(error, 0, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename);
-                       return NULL;
-               }
-               if (php_stream_tell(entry->fp) != (off_t)entry->uncompressed_filesize) {
-                       spprintf(error, 0, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename);
-                       return NULL;
-               }
                php_stream_seek(fp, offset + entry->compressed_filesize, SEEK_SET);
        } else { /* from here is for non-compressed */
                if (!for_write && !entry->is_modified) {