Author: mm
Date: Tue Dec 27 10:36:56 2011
New Revision: 228911
URL: http://svn.freebsd.org/changeset/base/228911

Log:
  Update to vendor revision 4016.
  
  Vendor has integrated most of our local changes in revisions 3976-3979 so
  future updates are going to be easier.
  Thanks to Tim Kientzle <[email protected]>.
  
  MFC after:    8 days

Replaced:
  head/contrib/libarchive/libarchive/test/test_compat_zip_2.zip.uu
     - copied unchanged from r228908, 
vendor/libarchive/dist/libarchive/test/test_compat_zip_2.zip.uu
Modified:
  head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c
  head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c
  head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c
Directory Properties:
  head/contrib/libarchive/   (props changed)
  head/contrib/libarchive/cpio/   (props changed)
  head/contrib/libarchive/libarchive/   (props changed)
  head/contrib/libarchive/libarchive_fe/   (props changed)
  head/contrib/libarchive/tar/   (props changed)

Modified: head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c
==============================================================================
--- head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c       
Tue Dec 27 10:34:00 2011        (r228910)
+++ head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c       
Tue Dec 27 10:36:56 2011        (r228911)
@@ -42,6 +42,10 @@ __FBSDID("$FreeBSD$");
 #include "archive_private.h"
 #include "archive_read_private.h"
 
+#ifdef _MSC_VER
+#define __packed
+#pragma pack(push, 1)
+#endif
 struct cpio_bin_header {
        unsigned char   c_magic[2];
        unsigned char   c_dev[2];
@@ -87,6 +91,11 @@ struct cpio_newc_header {
        char    c_crc[8];
 } __packed;
 
+#ifdef _MSC_VER
+#undef __packed
+#pragma pack(pop)
+#endif
+
 struct links_entry {
         struct links_entry      *next;
         struct links_entry      *previous;

Modified: 
head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c
==============================================================================
--- head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c    
Tue Dec 27 10:34:00 2011        (r228910)
+++ head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c    
Tue Dec 27 10:36:56 2011        (r228911)
@@ -302,8 +302,6 @@ struct file_info {
                struct file_info        *first;
                struct file_info        **last;
        } rede_files;
-       /* To check a ininity loop. */
-       struct file_info        *loop_by;
 };
 
 struct heap_queue {
@@ -1802,26 +1800,82 @@ parse_file_info(struct archive_read *a, 
                        file->re = 0;
                        parent->subdirs--;
                } else if (file->re) {
-                       /* This file's parent is not rr_moved, clear invalid
-                        * "RE" mark. */
-                       if (parent == NULL || parent->rr_moved == 0)
-                               file->re = 0;
-                       else if ((flags & 0x02) == 0) {
-                               file->rr_moved_has_re_only = 0;
-                               file->re = 0;
+                       /*
+                        * Sanity check: file's parent is rr_moved.
+                        */
+                       if (parent == NULL || parent->rr_moved == 0) {
+                               archive_set_error(&a->archive,
+                                   ARCHIVE_ERRNO_MISC,
+                                   "Invalid Rockridge RE");
+                               return (NULL);
+                       }
+                       /*
+                        * Sanity check: file does not have "CL" extension.
+                        */
+                       if (file->cl_offset) {
+                               archive_set_error(&a->archive,
+                                   ARCHIVE_ERRNO_MISC,
+                                   "Invalid Rockridge RE and CL");
+                               return (NULL);
+                       }
+                       /*
+                        * Sanity check: The file type must be a directory.
+                        */
+                       if ((flags & 0x02) == 0) {
+                               archive_set_error(&a->archive,
+                                   ARCHIVE_ERRNO_MISC,
+                                   "Invalid Rockridge RE");
+                               return (NULL);
                        }
                } else if (parent != NULL && parent->rr_moved)
                        file->rr_moved_has_re_only = 0;
                else if (parent != NULL && (flags & 0x02) &&
                    (parent->re || parent->re_descendant))
                        file->re_descendant = 1;
-               if (file->cl_offset != 0) {
+               if (file->cl_offset) {
+                       struct file_info *r;
+
+                       if (parent == NULL || parent->parent == NULL) {
+                               archive_set_error(&a->archive,
+                                   ARCHIVE_ERRNO_MISC,
+                                   "Invalid Rockridge CL");
+                               return (NULL);
+                       }
+                       /*
+                        * Sanity check: The file type must be a regular file.
+                        */
+                       if ((flags & 0x02) != 0) {
+                               archive_set_error(&a->archive,
+                                   ARCHIVE_ERRNO_MISC,
+                                   "Invalid Rockridge CL");
+                               return (NULL);
+                       }
                        parent->subdirs++;
                        /* Overwrite an offset and a number of this "CL" entry
                         * to appear before other dirs. "+1" to those is to
                         * make sure to appear after "RE" entry which this
                         * "CL" entry should be connected with. */
                        file->offset = file->number = file->cl_offset + 1;
+
+                       /*
+                        * Sanity check: cl_offset does not point at its
+                        * the parents or itself.
+                        */
+                       for (r = parent; r; r = r->parent) {
+                               if (r->offset == file->cl_offset) {
+                                       archive_set_error(&a->archive,
+                                           ARCHIVE_ERRNO_MISC,
+                                           "Invalid Rockridge CL");
+                                       return (NULL);
+                               }
+                       }
+                       if (file->cl_offset == file->offset ||
+                           parent->rr_moved) {
+                               archive_set_error(&a->archive,
+                                   ARCHIVE_ERRNO_MISC,
+                                   "Invalid Rockridge CL");
+                               return (NULL);
+                       }
                }
        }
 
@@ -1925,6 +1979,13 @@ parse_rockridge(struct archive_read *a, 
                                 */
                                break;
                        }
+                       if (p[0] == 'P' && p[1] == 'L') {
+                               /*
+                                * PL extension won't appear;
+                                * contents are always ignored.
+                                */
+                               break;
+                       }
                        if (p[0] == 'P' && p[1] == 'N') {
                                if (version == 1 && data_length == 16) {
                                        file->rdev = toi(data,4);
@@ -2700,15 +2761,12 @@ rede_add_entry(struct file_info *file)
 {
        struct file_info *re;
 
+       /*
+        * Find "RE" entry.
+        */
        re = file->parent;
-       while (re != NULL && !re->re) {
-               /* Sanity check to prevent a infinity loop
-                * cause by a currupted iso file. */
-               if (re->loop_by == file)
-                       return (-1);
-               re->loop_by = file;
+       while (re != NULL && !re->re)
                re = re->parent;
-       }
        if (re == NULL)
                return (-1);
 

Modified: head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c
==============================================================================
--- head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c  Tue Dec 
27 10:34:00 2011        (r228910)
+++ head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c  Tue Dec 
27 10:36:56 2011        (r228911)
@@ -62,6 +62,11 @@ struct cpio {
        size_t            ino_list_next;
 };
 
+#ifdef _MSC_VER
+#define __packed
+#pragma pack(push, 1)
+#endif
+
 struct cpio_header {
        char    c_magic[6];
        char    c_dev[6];
@@ -76,6 +81,11 @@ struct cpio_header {
        char    c_filesize[11];
 } __packed;
 
+#ifdef _MSC_VER
+#undef __packed
+#pragma pack(pop)
+#endif
+
 /*
  * Set output format to 'cpio' format.
  */

Copied: head/contrib/libarchive/libarchive/test/test_compat_zip_2.zip.uu (from 
r228908, vendor/libarchive/dist/libarchive/test/test_compat_zip_2.zip.uu)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/libarchive/libarchive/test/test_compat_zip_2.zip.uu    Tue Dec 
27 10:36:56 2011        (r228911, copy of r228908, 
vendor/libarchive/dist/libarchive/test/test_compat_zip_2.zip.uu)
@@ -0,0 +1,10 @@
+$FreeBSD$
+
+begin 644 test_compat_zip_2.zip
+M4$L#!`H``````'V59CT````````````````%````9FEL93$M2E5.2RU02P,$
+M"@``````@95F/<>D!,D&````!@````4```!F:6QE,F9I;&4R"E!+`0(>`PH`
+M`````'V59CT````````````````%``````````````"D@0````!F:6QE,5!+
+M`0(>`PH``````(&59CW'I`3)!@````8````%``````````````"D@2D```!F
+::6QE,E!+!08``````@`"`&8```!2````````
+`
+end
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to