sfox            Sat May 24 13:59:57 2008 UTC

  Modified files:              
    /php-src/ext/phar   phar.c phar_internal.h phar_object.c tar.c 
  Log:
  - MFB fix offset detection in tar files
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.c?r1=1.374&r2=1.375&diff_format=u
Index: php-src/ext/phar/phar.c
diff -u php-src/ext/phar/phar.c:1.374 php-src/ext/phar/phar.c:1.375
--- php-src/ext/phar/phar.c:1.374       Sat May 17 20:07:38 2008
+++ php-src/ext/phar/phar.c     Sat May 24 13:59:56 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: phar.c,v 1.374 2008/05/17 20:07:38 cellog Exp $ */
+/* $Id: phar.c,v 1.375 2008/05/24 13:59:56 sfox Exp $ */
 
 #define PHAR_MAIN 1
 #include "phar_internal.h"
@@ -101,7 +101,7 @@
  * When all uses of a phar have been concluded, this frees the manifest
  * and the phar slot
  */
-static void phar_destroy_phar_data(phar_archive_data *phar TSRMLS_DC) /* {{{ */
+void phar_destroy_phar_data(phar_archive_data *phar TSRMLS_DC) /* {{{ */
 {
        if (phar->alias && phar->alias != phar->fname) {
                efree(phar->alias);
@@ -3025,7 +3025,7 @@
        php_info_print_table_header(2, "Phar: PHP Archive support", "enabled");
        php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION);
        php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION);
-       php_info_print_table_row(2, "CVS revision", "$Revision: 1.374 $");
+       php_info_print_table_row(2, "CVS revision", "$Revision: 1.375 $");
        php_info_print_table_row(2, "Phar-based phar archives", "enabled");
        php_info_print_table_row(2, "Tar-based phar archives", "enabled");
        php_info_print_table_row(2, "ZIP-based phar archives", "enabled");
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_internal.h?r1=1.112&r2=1.113&diff_format=u
Index: php-src/ext/phar/phar_internal.h
diff -u php-src/ext/phar/phar_internal.h:1.112 
php-src/ext/phar/phar_internal.h:1.113
--- php-src/ext/phar/phar_internal.h:1.112      Sat May 17 20:07:38 2008
+++ php-src/ext/phar/phar_internal.h    Sat May 24 13:59:56 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: phar_internal.h,v 1.112 2008/05/17 20:07:38 cellog Exp $ */
+/* $Id: phar_internal.h,v 1.113 2008/05/24 13:59:56 sfox Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -395,6 +395,7 @@
 void phar_request_initialize(TSRMLS_D);
 
 void phar_object_init(TSRMLS_D);
+void phar_destroy_phar_data(phar_archive_data *phar TSRMLS_DC);
 
 int phar_open_entry_file(phar_archive_data *phar, phar_entry_info *entry, char 
**error TSRMLS_DC);
 int phar_open_filename(char *fname, int fname_len, char *alias, int alias_len, 
int options, phar_archive_data** pphar, char **error TSRMLS_DC);
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_object.c?r1=1.277&r2=1.278&diff_format=u
Index: php-src/ext/phar/phar_object.c
diff -u php-src/ext/phar/phar_object.c:1.277 
php-src/ext/phar/phar_object.c:1.278
--- php-src/ext/phar/phar_object.c:1.277        Wed May 21 20:39:33 2008
+++ php-src/ext/phar/phar_object.c      Sat May 24 13:59:56 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: phar_object.c,v 1.277 2008/05/21 20:39:33 cellog Exp $ */
+/* $Id: phar_object.c,v 1.278 2008/05/24 13:59:56 sfox Exp $ */
 
 #include "phar_internal.h"
 #include "func_interceptors.h"
@@ -1918,6 +1918,15 @@
        if (SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), newpath, 
phar->fname_len, (void **) &pphar)) {
                if ((*pphar)->fname_len == phar->fname_len && 
!memcmp((*pphar)->fname, phar->fname, phar->fname_len)) {
                        if (!zend_hash_num_elements(&phar->manifest)) {
+                               (*pphar)->is_tar = phar->is_tar;
+                               (*pphar)->is_zip = phar->is_zip;
+                               (*pphar)->is_data = phar->is_data;
+                               (*pphar)->flags = phar->flags;
+                               (*pphar)->fp = phar->fp;
+                               phar->fp = NULL;
+                               phar_destroy_phar_data(phar TSRMLS_CC);
+                               phar = *pphar;
+                               newpath = oldpath;
                                goto its_ok;
                        }
                }
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tar.c?r1=1.56&r2=1.57&diff_format=u
Index: php-src/ext/phar/tar.c
diff -u php-src/ext/phar/tar.c:1.56 php-src/ext/phar/tar.c:1.57
--- php-src/ext/phar/tar.c:1.56 Thu May 15 23:46:32 2008
+++ php-src/ext/phar/tar.c      Sat May 24 13:59:56 2008
@@ -225,10 +225,11 @@
        entry.is_tar = 1;
        entry.is_crc_checked = 1;
        entry.phar = myphar;
+       pos += sizeof(buf);
        do {
                phar_entry_info *newentry;
 
-               pos += sizeof(buf);
+               pos = php_stream_tell(fp);
                hdr = (tar_header*) buf;
                sum1 = phar_tar_number(hdr->checksum, sizeof(hdr->checksum));
                if (sum1 == 0 && phar_tar_checksum(buf, sizeof(buf)) == 0) {
@@ -385,7 +386,6 @@
                        }
                }
                size = (size+511)&~511;
-               pos += size;
                if (((hdr->typeflag == 0) || (hdr->typeflag == TAR_FILE)) && 
size > 0) {
                        /* this is not good enough - seek succeeds even on 
truncated tars */
                        php_stream_seek(fp, size, SEEK_CUR);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to