Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/libarchive/dist/libarchive Merge changes from l...



details:   https://anonhg.NetBSD.org/src/rev/331390a32aa0
branches:  trunk
changeset: 452792:331390a32aa0
user:      joerg <joerg%NetBSD.org@localhost>
date:      Wed Jul 24 14:03:57 2019 +0000

description:
Merge changes from libarchive 3.4.0.

diffstat:

 external/bsd/libarchive/dist/libarchive/archive.h                             |  12 +-
 external/bsd/libarchive/dist/libarchive/archive_openssl_hmac_private.h        |   3 +-
 external/bsd/libarchive/dist/libarchive/archive_pack_dev.c                    |  10 +-
 external/bsd/libarchive/dist/libarchive/archive_pack_dev.h                    |   2 +-
 external/bsd/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c   |  16 +-
 external/bsd/libarchive/dist/libarchive/archive_read_support_format_iso9660.c |  51 ++++++---
 external/bsd/libarchive/dist/libarchive/archive_write.3                       |   2 +-
 external/bsd/libarchive/dist/libarchive/archive_write_set_format_ar.c         |  22 ++-
 external/bsd/libarchive/dist/libarchive/archive_write_set_format_shar.c       |   6 +-
 external/bsd/libarchive/dist/libarchive/archive_write_set_format_ustar.c      |   9 +-
 10 files changed, 83 insertions(+), 50 deletions(-)

diffs (truncated from 455 to 300 lines):

diff -r d35376b6f59c -r 331390a32aa0 external/bsd/libarchive/dist/libarchive/archive.h
--- a/external/bsd/libarchive/dist/libarchive/archive.h Wed Jul 24 13:50:20 2019 +0000
+++ b/external/bsd/libarchive/dist/libarchive/archive.h Wed Jul 24 14:03:57 2019 +0000
@@ -36,7 +36,7 @@
  * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
  */
 /* Note: Compiler will complain if this does not match archive_entry.h! */
-#define        ARCHIVE_VERSION_NUMBER 3003002
+#define        ARCHIVE_VERSION_NUMBER 3004000
 
 #include <sys/stat.h>
 #include <stddef.h>  /* for wchar_t */
@@ -155,7 +155,7 @@
 /*
  * Textual name/version of the library, useful for version displays.
  */
-#define        ARCHIVE_VERSION_ONLY_STRING "3.3.2dev"
+#define        ARCHIVE_VERSION_ONLY_STRING "3.4.0"
 #define        ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
 __LA_DECL const char * archive_version_string(void);
 
@@ -177,6 +177,7 @@
 __LA_DECL const char *  archive_liblzma_version(void);
 __LA_DECL const char *  archive_bzlib_version(void);
 __LA_DECL const char *  archive_liblz4_version(void);
+__LA_DECL const char *  archive_libzstd_version(void);
 
 /* Declare our basic types. */
 struct archive;
@@ -276,6 +277,7 @@
 #define        ARCHIVE_FILTER_LZOP     11
 #define        ARCHIVE_FILTER_GRZIP    12
 #define        ARCHIVE_FILTER_LZ4      13
+#define        ARCHIVE_FILTER_ZSTD     14
 
 #if ARCHIVE_VERSION_NUMBER < 4000000
 #define        ARCHIVE_COMPRESSION_NONE        ARCHIVE_FILTER_NONE
@@ -338,6 +340,7 @@
 #define        ARCHIVE_FORMAT_RAR                      0xD0000
 #define        ARCHIVE_FORMAT_7ZIP                     0xE0000
 #define        ARCHIVE_FORMAT_WARC                     0xF0000
+#define        ARCHIVE_FORMAT_RAR_V5                   0x100000
 
 /*
  * Codes returned by archive_read_format_capabilities().
@@ -433,6 +436,7 @@
 __LA_DECL int archive_read_support_filter_rpm(struct archive *);
 __LA_DECL int archive_read_support_filter_uu(struct archive *);
 __LA_DECL int archive_read_support_filter_xz(struct archive *);
+__LA_DECL int archive_read_support_filter_zstd(struct archive *);
 
 __LA_DECL int archive_read_support_format_7zip(struct archive *);
 __LA_DECL int archive_read_support_format_all(struct archive *);
@@ -446,6 +450,7 @@
 __LA_DECL int archive_read_support_format_lha(struct archive *);
 __LA_DECL int archive_read_support_format_mtree(struct archive *);
 __LA_DECL int archive_read_support_format_rar(struct archive *);
+__LA_DECL int archive_read_support_format_rar5(struct archive *);
 __LA_DECL int archive_read_support_format_raw(struct archive *);
 __LA_DECL int archive_read_support_format_tar(struct archive *);
 __LA_DECL int archive_read_support_format_warc(struct archive *);
@@ -778,6 +783,7 @@
                     const char *cmd);
 __LA_DECL int archive_write_add_filter_uuencode(struct archive *);
 __LA_DECL int archive_write_add_filter_xz(struct archive *);
+__LA_DECL int archive_write_add_filter_zstd(struct archive *);
 
 
 /* A convenience function to set the format based on the code or name. */
@@ -1089,6 +1095,8 @@
  */
 __LA_DECL int  archive_match_path_excluded(struct archive *,
                    struct archive_entry *);
+/* Control recursive inclusion of directory content when directory is included. Default on. */
+__LA_DECL int  archive_match_set_inclusion_recursion(struct archive *, int);
 /* Add exclusion pathname pattern. */
 __LA_DECL int  archive_match_exclude_pattern(struct archive *, const char *);
 __LA_DECL int  archive_match_exclude_pattern_w(struct archive *,
diff -r d35376b6f59c -r 331390a32aa0 external/bsd/libarchive/dist/libarchive/archive_openssl_hmac_private.h
--- a/external/bsd/libarchive/dist/libarchive/archive_openssl_hmac_private.h    Wed Jul 24 13:50:20 2019 +0000
+++ b/external/bsd/libarchive/dist/libarchive/archive_openssl_hmac_private.h    Wed Jul 24 14:03:57 2019 +0000
@@ -28,7 +28,8 @@
 #include <openssl/hmac.h>
 #include <openssl/opensslv.h>
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
+       (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
 #include <stdlib.h> /* malloc, free */
 #include <string.h> /* memset */
 static inline HMAC_CTX *HMAC_CTX_new(void)
diff -r d35376b6f59c -r 331390a32aa0 external/bsd/libarchive/dist/libarchive/archive_pack_dev.c
--- a/external/bsd/libarchive/dist/libarchive/archive_pack_dev.c        Wed Jul 24 13:50:20 2019 +0000
+++ b/external/bsd/libarchive/dist/libarchive/archive_pack_dev.c        Wed Jul 24 14:03:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: archive_pack_dev.c,v 1.2 2017/04/20 13:01:40 joerg Exp $       */
+/*     $NetBSD: archive_pack_dev.c,v 1.3 2019/07/24 14:03:57 joerg Exp $       */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #include <sys/cdefs.h>
 #endif
 #if !defined(lint)
-__RCSID("$NetBSD: archive_pack_dev.c,v 1.2 2017/04/20 13:01:40 joerg Exp $");
+__RCSID("$NetBSD: archive_pack_dev.c,v 1.3 2019/07/24 14:03:57 joerg Exp $");
 #endif /* not lint */
 
 #ifdef HAVE_LIMITS_H
@@ -57,6 +57,12 @@
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
+#ifdef HAVE_SYS_MKDEV_H
+#include <sys/mkdev.h>
+#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
diff -r d35376b6f59c -r 331390a32aa0 external/bsd/libarchive/dist/libarchive/archive_pack_dev.h
--- a/external/bsd/libarchive/dist/libarchive/archive_pack_dev.h        Wed Jul 24 13:50:20 2019 +0000
+++ b/external/bsd/libarchive/dist/libarchive/archive_pack_dev.h        Wed Jul 24 14:03:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: archive_pack_dev.h,v 1.2 2017/04/20 13:01:40 joerg Exp $       */
+/*     $NetBSD: archive_pack_dev.h,v 1.3 2019/07/24 14:03:57 joerg Exp $       */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
diff -r d35376b6f59c -r 331390a32aa0 external/bsd/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c
--- a/external/bsd/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c       Wed Jul 24 13:50:20 2019 +0000
+++ b/external/bsd/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c       Wed Jul 24 14:03:57 2019 +0000
@@ -127,7 +127,7 @@
 /*
  * Enter working directory and return working pathname of archive_entry.
  * If a pointer to an integer is provided and its value is below zero
- * open a file descriptor on this pahtname.
+ * open a file descriptor on this pathname.
  */
 const char *
 archive_read_disk_entry_setup_path(struct archive_read_disk *a,
@@ -163,6 +163,9 @@
        int initial_fd = fd;
        int r, r1;
 
+       archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_ANY,
+               "archive_read_disk_entry_from_file");
+
        archive_clear_error(_a);
        path = archive_entry_sourcepath(entry);
        if (path == NULL)
@@ -188,7 +191,7 @@
                                }
                        } else
 #endif
-                       if (stat(path, &s) != 0) {
+                       if (la_stat(path, &s) != 0) {
                                archive_set_error(&a->archive, errno,
                                    "Can't stat %s", path);
                                return (ARCHIVE_FAILED);
@@ -928,11 +931,10 @@
                return (ARCHIVE_OK);
 
        /* Does filesystem support the reporting of hole ? */
-       if (*fd < 0) {
+       if (*fd < 0)
                path = archive_read_disk_entry_setup_path(a, entry, fd);
-               if (path == NULL)
-                       return (ARCHIVE_FAILED);
-       }
+       else
+               path = NULL;
 
        if (*fd >= 0) {
 #ifdef _PC_MIN_HOLE_SIZE
@@ -943,6 +945,8 @@
                if (initial_off != 0)
                        lseek(*fd, 0, SEEK_SET);
        } else {
+               if (path == NULL)
+                       return (ARCHIVE_FAILED);
 #ifdef _PC_MIN_HOLE_SIZE
                if (pathconf(path, _PC_MIN_HOLE_SIZE) <= 0)
                        return (ARCHIVE_OK);
diff -r d35376b6f59c -r 331390a32aa0 external/bsd/libarchive/dist/libarchive/archive_read_support_format_iso9660.c
--- a/external/bsd/libarchive/dist/libarchive/archive_read_support_format_iso9660.c     Wed Jul 24 13:50:20 2019 +0000
+++ b/external/bsd/libarchive/dist/libarchive/archive_read_support_format_iso9660.c     Wed Jul 24 14:03:57 2019 +0000
@@ -409,7 +409,8 @@
                    struct file_info **);
 static struct file_info *
                parse_file_info(struct archive_read *a,
-                   struct file_info *parent, const unsigned char *isodirrec);
+                   struct file_info *parent, const unsigned char *isodirrec,
+                   size_t reclen);
 static int     parse_rockridge(struct archive_read *a,
                    struct file_info *file, const unsigned char *start,
                    const unsigned char *end);
@@ -1022,7 +1023,7 @@
                        if (*(p + DR_name_len_offset) == 1
                            && *(p + DR_name_offset) == '\001')
                                continue;
-                       child = parse_file_info(a, parent, p);
+                       child = parse_file_info(a, parent, p, b - p);
                        if (child == NULL) {
                                __archive_read_consume(a, skip_size);
                                return (ARCHIVE_FATAL);
@@ -1112,7 +1113,7 @@
         */
        seenJoliet = iso9660->seenJoliet;/* Save flag. */
        iso9660->seenJoliet = 0;
-       file = parse_file_info(a, NULL, block);
+       file = parse_file_info(a, NULL, block, vd->size);
        if (file == NULL)
                return (ARCHIVE_FATAL);
        iso9660->seenJoliet = seenJoliet;
@@ -1144,7 +1145,7 @@
                        return (ARCHIVE_FATAL);
                }
                iso9660->seenJoliet = 0;
-               file = parse_file_info(a, NULL, block);
+               file = parse_file_info(a, NULL, block, vd->size);
                if (file == NULL)
                        return (ARCHIVE_FATAL);
                iso9660->seenJoliet = seenJoliet;
@@ -1723,8 +1724,7 @@
        free(iso9660->read_ce_req.reqs);
        archive_string_free(&iso9660->pathname);
        archive_string_free(&iso9660->previous_pathname);
-       if (iso9660->pending_files.files)
-               free(iso9660->pending_files.files);
+       free(iso9660->pending_files.files);
 #ifdef HAVE_ZLIB_H
        free(iso9660->entry_zisofs.uncompressed_buffer);
        free(iso9660->entry_zisofs.block_pointers);
@@ -1749,7 +1749,7 @@
  */
 static struct file_info *
 parse_file_info(struct archive_read *a, struct file_info *parent,
-    const unsigned char *isodirrec)
+    const unsigned char *isodirrec, size_t reclen)
 {
        struct iso9660 *iso9660;
        struct file_info *file, *filep;
@@ -1763,16 +1763,20 @@
 
        iso9660 = (struct iso9660 *)(a->format->data);
 
-       dr_len = (size_t)isodirrec[DR_length_offset];
+       if (reclen != 0)
+               dr_len = (size_t)isodirrec[DR_length_offset];
+       /*
+        * Sanity check that reclen is not zero and dr_len is greater than
+        * reclen but at least 34
+        */
+       if (reclen == 0 || reclen < dr_len || dr_len < 34) {
+               archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                       "Invalid length of directory record");
+               return (NULL);
+       }
        name_len = (size_t)isodirrec[DR_name_len_offset];
        location = archive_le32dec(isodirrec + DR_extent_offset);
        fsize = toi(isodirrec + DR_size_offset, DR_size_size);
-       /* Sanity check that dr_len needs at least 34. */
-       if (dr_len < 34) {
-               archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                   "Invalid length of directory record");
-               return (NULL);
-       }
        /* Sanity check that name_len doesn't exceed dr_len. */
        if (dr_len - 33 < name_len || name_len == 0) {
                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
@@ -2097,6 +2101,7 @@
     const unsigned char *p, const unsigned char *end)
 {
        struct iso9660 *iso9660;
+       int entry_seen = 0;
 
        iso9660 = (struct iso9660 *)(a->format->data);
 
@@ -2252,8 +2257,16 @@
                }
 
                p += p[2];
+               entry_seen = 1;
        }
-       return (ARCHIVE_OK);
+
+       if (entry_seen)
+               return (ARCHIVE_OK);
+       else {
+               archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                                 "Tried to parse Rockridge extensions, but none found");
+               return (ARCHIVE_WARN);
+       }
 }
 
 static int
@@ -3021,10 +3034,10 @@



Home | Main Index | Thread Index | Old Index