From owner-svn-src-head@freebsd.org Tue Dec 6 01:35:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D734CC66B39; Tue, 6 Dec 2016 01:35:30 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9FB351CCE; Tue, 6 Dec 2016 01:35:30 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB61ZTw0098624; Tue, 6 Dec 2016 01:35:29 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB61ZRx5098601; Tue, 6 Dec 2016 01:35:27 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201612060135.uB61ZRx5098601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Tue, 6 Dec 2016 01:35:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309590 - in head: contrib/libarchive/cat/test contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2016 01:35:30 -0000 Author: mm Date: Tue Dec 6 01:35:27 2016 New Revision: 309590 URL: https://svnweb.freebsd.org/changeset/base/309590 Log: MFV r309587: Sync libarchive with vendor. Vendor bugfixes: libarchive #831: Spelling fixes libarchive #832: Relax sanity checks of number fields in tar header even more OSS-Fuzz #16: Fix possible hang in uudecode_filter_read() OSS-Fuzz #220: Reject an 'ar' filename table larger than 1GB or a filename larger than 1MB. MFC after: 1 week Added: head/contrib/libarchive/libarchive/test/test_compat_plexus_archiver_tar.c - copied unchanged from r309587, vendor/libarchive/dist/libarchive/test/test_compat_plexus_archiver_tar.c head/contrib/libarchive/libarchive/test/test_compat_plexus_archiver_tar.tar.uu - copied unchanged from r309587, vendor/libarchive/dist/libarchive/test/test_compat_plexus_archiver_tar.tar.uu Modified: head/contrib/libarchive/cat/test/main.c head/contrib/libarchive/cpio/test/main.c head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c head/contrib/libarchive/libarchive/archive_read_support_filter_uu.c head/contrib/libarchive/libarchive/archive_read_support_format_ar.c head/contrib/libarchive/libarchive/archive_read_support_format_cab.c head/contrib/libarchive/libarchive/archive_read_support_format_tar.c head/contrib/libarchive/libarchive/archive_string.c head/contrib/libarchive/libarchive/archive_string.h head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c head/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c head/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c head/contrib/libarchive/libarchive/archive_write_set_format_mtree.c head/contrib/libarchive/libarchive/archive_write_set_format_pax.c head/contrib/libarchive/libarchive/archive_write_set_format_ustar.c head/contrib/libarchive/libarchive/archive_write_set_format_v7tar.c head/contrib/libarchive/libarchive/archive_write_set_format_zip.c head/contrib/libarchive/libarchive/test/main.c head/contrib/libarchive/libarchive/test/test_archive_cmdline.c head/lib/libarchive/tests/Makefile Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/cat/test/main.c ============================================================================== --- head/contrib/libarchive/cat/test/main.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/cat/test/main.c Tue Dec 6 01:35:27 2016 (r309590) @@ -520,7 +520,7 @@ _utf8_to_unicode(uint32_t *pwc, const ch return (0); /* Standard: return 0 for end-of-string. */ cnt = utf8_count[ch]; - /* Invalide sequence or there are not plenty bytes. */ + /* Invalid sequence or there are not plenty bytes. */ if (n < (size_t)cnt) return (-1); @@ -559,7 +559,7 @@ _utf8_to_unicode(uint32_t *pwc, const ch return (-1); } - /* The code point larger than 0x10FFFF is not leagal + /* The code point larger than 0x10FFFF is not legal * Unicode values. */ if (wc > 0x10FFFF) return (-1); Modified: head/contrib/libarchive/cpio/test/main.c ============================================================================== --- head/contrib/libarchive/cpio/test/main.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/cpio/test/main.c Tue Dec 6 01:35:27 2016 (r309590) @@ -521,7 +521,7 @@ _utf8_to_unicode(uint32_t *pwc, const ch return (0); /* Standard: return 0 for end-of-string. */ cnt = utf8_count[ch]; - /* Invalide sequence or there are not plenty bytes. */ + /* Invalid sequence or there are not plenty bytes. */ if (n < (size_t)cnt) return (-1); @@ -560,7 +560,7 @@ _utf8_to_unicode(uint32_t *pwc, const ch return (-1); } - /* The code point larger than 0x10FFFF is not leagal + /* The code point larger than 0x10FFFF is not legal * Unicode values. */ if (wc > 0x10FFFF) return (-1); Modified: head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Tue Dec 6 01:35:27 2016 (r309590) @@ -690,7 +690,7 @@ translate_acl(struct archive_read_disk * #ifdef ACL_TYPE_NFS4 if (default_entry_acl_type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) { /* - * acl_get_entry_type_np() falis with non-NFSv4 ACLs + * acl_get_entry_type_np() fails with non-NFSv4 ACLs */ if (acl_get_entry_type_np(acl_entry, &acl_type) != 0) { archive_set_error(&a->archive, errno, "Failed " @@ -1194,7 +1194,7 @@ setup_sparse_fiemap(struct archive_read_ if (r < 0) { /* When something error happens, it is better we * should return ARCHIVE_OK because an earlier - * version(<2.6.28) cannot perfom FS_IOC_FIEMAP. */ + * version(<2.6.28) cannot perform FS_IOC_FIEMAP. */ goto exit_setup_sparse_fiemap; } if (fm->fm_mapped_extents == 0) { @@ -1354,7 +1354,7 @@ setup_sparse(struct archive_read_disk *a goto exit_setup_sparse; } if (off_s == 0 && off_e == size) - break;/* This is not spase. */ + break;/* This is not sparse. */ archive_entry_sparse_add_entry(entry, off_s, off_e - off_s); off_s = off_e; Modified: head/contrib/libarchive/libarchive/archive_read_support_filter_uu.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_filter_uu.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_read_support_filter_uu.c Tue Dec 6 01:35:27 2016 (r309590) @@ -511,6 +511,13 @@ read_more: } llen = len; if ((nl == 0) && (uudecode->state != ST_UUEND)) { + if (total == 0 && ravail <= 0) { + /* There is nothing more to read, fail */ + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Missing format data"); + return (ARCHIVE_FATAL); + } /* * Save remaining data which does not contain * NL('\n','\r'). @@ -567,7 +574,7 @@ read_more: "Insufficient compressed data"); return (ARCHIVE_FATAL); } - /* Get length of undecoded bytes of curent line. */ + /* Get length of undecoded bytes of current line. */ l = UUDECODE(*b++); body--; if (l > body) { Modified: head/contrib/libarchive/libarchive/archive_read_support_format_ar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_ar.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_read_support_format_ar.c Tue Dec 6 01:35:27 2016 (r309590) @@ -260,7 +260,7 @@ _ar_read_header(struct archive_read *a, archive_entry_set_filetype(entry, AE_IFREG); /* Get the size of the filename table. */ number = ar_atol10(h + AR_size_offset, AR_size_size); - if (number > SIZE_MAX) { + if (number > SIZE_MAX || number > 1024 * 1024 * 1024) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Filename table too large"); return (ARCHIVE_FATAL); @@ -342,16 +342,19 @@ _ar_read_header(struct archive_read *a, /* Parse the size of the name, adjust the file size. */ number = ar_atol10(h + AR_name_offset + 3, AR_name_size - 3); - bsd_name_length = (size_t)number; - /* Guard against the filename + trailing NUL - * overflowing a size_t and against the filename size - * being larger than the entire entry. */ - if (number > (uint64_t)(bsd_name_length + 1) - || (int64_t)bsd_name_length > ar->entry_bytes_remaining) { + /* Sanity check the filename length: + * = Must be <= SIZE_MAX - 1 + * = Must be <= 1MB + * = Cannot be bigger than the entire entry + */ + if (number > SIZE_MAX - 1 + || number > 1024 * 1024 + || (int64_t)number > ar->entry_bytes_remaining) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Bad input file size"); return (ARCHIVE_FATAL); } + bsd_name_length = (size_t)number; ar->entry_bytes_remaining -= bsd_name_length; /* Adjust file size reported to client. */ archive_entry_set_size(entry, ar->entry_bytes_remaining); Modified: head/contrib/libarchive/libarchive/archive_read_support_format_cab.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_cab.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_read_support_format_cab.c Tue Dec 6 01:35:27 2016 (r309590) @@ -67,7 +67,7 @@ struct lzx_dec { /* The length how many bytes we can copy decoded code from * the window. */ int copy_len; - /* Translation reversal for x86 proccessor CALL byte sequence(E8). + /* Translation reversal for x86 processor CALL byte sequence(E8). * This is used for LZX only. */ uint32_t translation_size; char translation; @@ -1555,7 +1555,7 @@ cab_read_ahead_cfdata_deflate(struct arc /* * Note: I suspect there is a bug in makecab.exe because, in rare * case, compressed bytes are still remaining regardless we have - * gotten all uncompressed bytes, which size is recoded in CFDATA, + * gotten all uncompressed bytes, which size is recorded in CFDATA, * as much as we need, and we have to use the garbage so as to * correctly compute the sum of CFDATA accordingly. */ @@ -1742,7 +1742,7 @@ cab_read_ahead_cfdata_lzx(struct archive } /* - * Translation reversal of x86 proccessor CALL byte sequence(E8). + * Translation reversal of x86 processor CALL byte sequence(E8). */ lzx_translation(&cab->xstrm, cab->uncompressed_buffer, cfdata->uncompressed_size, @@ -2271,7 +2271,7 @@ static int lzx_br_fillup(struct lzx_stream *strm, struct lzx_br *br) { /* - * x86 proccessor family can read misaligned data without an access error. + * x86 processor family can read misaligned data without an access error. */ int n = CACHE_BITS - br->cache_avail; Modified: head/contrib/libarchive/libarchive/archive_read_support_format_tar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_tar.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_read_support_format_tar.c Tue Dec 6 01:35:27 2016 (r309590) @@ -299,14 +299,21 @@ archive_read_format_tar_cleanup(struct a * * This has to be pretty lenient in order to accomodate the enormous * variety of tar writers in the world: - * = POSIX ustar requires octal values with leading zeros and - * specific termination on fields + * = POSIX (IEEE Std 1003.1-1988) ustar requires octal values with leading + * zeros and allows fields to be terminated with space or null characters * = Many writers use different termination (in particular, libarchive * omits terminator bytes to squeeze one or two more digits) * = Many writers pad with space and omit leading zeros * = GNU tar and star write base-256 values if numbers are too * big to be represented in octal * + * Examples of specific tar headers that we should support: + * = Perl Archive::Tar terminates uid, gid, devminor and devmajor with two + * null bytes, pads size with spaces and other numeric fields with zeroes + * = plexus-archiver prior to 2.6.3 (before switching to commons-compress) + * may have uid and gid fields filled with spaces without any octal digits + * at all and pads all numeric fields with spaces + * * This should tolerate all variants in use. It will reject a field * where the writer just left garbage after a trailing NUL. */ Modified: head/contrib/libarchive/libarchive/archive_string.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_string.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_string.c Tue Dec 6 01:35:27 2016 (r309590) @@ -2298,7 +2298,7 @@ _utf8_to_unicode(uint32_t *pwc, const ch return (0); /* Standard: return 0 for end-of-string. */ cnt = utf8_count[ch]; - /* Invalide sequence or there are not plenty bytes. */ + /* Invalid sequence or there are not plenty bytes. */ if ((int)n < cnt) { cnt = (int)n; for (i = 1; i < cnt; i++) { @@ -2379,7 +2379,7 @@ _utf8_to_unicode(uint32_t *pwc, const ch goto invalid_sequence; } - /* The code point larger than 0x10FFFF is not leagal + /* The code point larger than 0x10FFFF is not legal * Unicode values. */ if (wc > UNICODE_MAX) goto invalid_sequence; @@ -2397,7 +2397,7 @@ utf8_to_unicode(uint32_t *pwc, const cha int cnt; cnt = _utf8_to_unicode(pwc, s, n); - /* Any of Surrogate pair is not leagal Unicode values. */ + /* Any of Surrogate pair is not legal Unicode values. */ if (cnt == 3 && IS_SURROGATE_PAIR_LA(*pwc)) return (-3); return (cnt); @@ -2458,7 +2458,7 @@ invalid_sequence: /* * Convert a Unicode code point to a single UTF-8 sequence. * - * NOTE:This function does not check if the Unicode is leagal or not. + * NOTE:This function does not check if the Unicode is legal or not. * Please you definitely check it before calling this. */ static size_t @@ -2554,7 +2554,7 @@ utf16_to_unicode(uint32_t *pwc, const ch * Surrogate pair values(0xd800 through 0xdfff) are only * used by UTF-16, so, after above culculation, the code * must not be surrogate values, and Unicode has no codes - * larger than 0x10ffff. Thus, those are not leagal Unicode + * larger than 0x10ffff. Thus, those are not legal Unicode * values. */ if (IS_SURROGATE_PAIR_LA(uc) || uc > UNICODE_MAX) { Modified: head/contrib/libarchive/libarchive/archive_string.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_string.h Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_string.h Tue Dec 6 01:35:27 2016 (r309590) @@ -115,13 +115,13 @@ archive_string_conversion_set_opt(struct /* Copy one archive_string to another in locale conversion. - * Return -1 if conversion failes. */ + * Return -1 if conversion fails. */ int archive_strncpy_l(struct archive_string *, const void *, size_t, struct archive_string_conv *); /* Copy one archive_string to another in locale conversion. - * Return -1 if conversion failes. */ + * Return -1 if conversion fails. */ int archive_strncat_l(struct archive_string *, const void *, size_t, struct archive_string_conv *); Modified: head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c Tue Dec 6 01:35:27 2016 (r309590) @@ -205,7 +205,7 @@ struct _7zip { /* * The list of the file entries which has its contents is used to * manage struct file objects. - * We use 'next' a menber of struct file to chain. + * We use 'next' (a member of struct file) to chain. */ struct { struct file *first; Modified: head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c Tue Dec 6 01:35:27 2016 (r309590) @@ -289,7 +289,7 @@ write_header(struct archive_write *a, st sconv = get_sconv(a); #if defined(_WIN32) && !defined(__CYGWIN__) - /* Make sure the path separators in pahtname, hardlink and symlink + /* Make sure the path separators in pathname, hardlink and symlink * are all slash '/', not the Windows path separator '\'. */ entry_main = __la_win_entry_in_posix_pathseparator(entry); if (entry_main == NULL) { Modified: head/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c Tue Dec 6 01:35:27 2016 (r309590) @@ -232,7 +232,7 @@ write_header(struct archive_write *a, st sconv = get_sconv(a); #if defined(_WIN32) && !defined(__CYGWIN__) - /* Make sure the path separators in pahtname, hardlink and symlink + /* Make sure the path separators in pathname, hardlink and symlink * are all slash '/', not the Windows path separator '\'. */ entry_main = __la_win_entry_in_posix_pathseparator(entry); if (entry_main == NULL) { Modified: head/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c Tue Dec 6 01:35:27 2016 (r309590) @@ -119,9 +119,9 @@ static const char template_header[] = { '0','0','0','0','0','0', '0','\0', /* gid, null termination: 8 bytes */ '0','0','0','0','0','0', '0','\0', - /* size, space termation: 12 bytes */ + /* size, space termination: 12 bytes */ '0','0','0','0','0','0','0','0','0','0','0', '\0', - /* mtime, space termation: 12 bytes */ + /* mtime, space termination: 12 bytes */ '0','0','0','0','0','0','0','0','0','0','0', '\0', /* Initial checksum value: 8 spaces */ ' ',' ',' ',' ',' ',' ',' ',' ', @@ -368,7 +368,7 @@ archive_write_gnutar_header(struct archi } #if defined(_WIN32) && !defined(__CYGWIN__) - /* Make sure the path separators in pahtname, hardlink and symlink + /* Make sure the path separators in pathname, hardlink and symlink * are all slash '/', not the Windows path separator '\'. */ entry_main = __la_win_entry_in_posix_pathseparator(entry); if (entry_main == NULL) { Modified: head/contrib/libarchive/libarchive/archive_write_set_format_mtree.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_mtree.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_write_set_format_mtree.c Tue Dec 6 01:35:27 2016 (r309590) @@ -1840,9 +1840,9 @@ mtree_entry_setup_filenames(struct archi len = strlen(p); /* - * Add "./" prefiex. + * Add "./" prefix. * NOTE: If the pathname does not have a path separator, we have - * to add "./" to the head of the pathename because mtree reader + * to add "./" to the head of the pathname because mtree reader * will suppose that it is v1(a.k.a classic) mtree format and * change the directory unexpectedly and so it will make a wrong * path. Modified: head/contrib/libarchive/libarchive/archive_write_set_format_pax.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_pax.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_write_set_format_pax.c Tue Dec 6 01:35:27 2016 (r309590) @@ -709,7 +709,7 @@ archive_write_pax_header(struct archive_ /* Copy entry so we can modify it as needed. */ #if defined(_WIN32) && !defined(__CYGWIN__) - /* Make sure the path separators in pahtname, hardlink and symlink + /* Make sure the path separators in pathname, hardlink and symlink * are all slash '/', not the Windows path separator '\'. */ entry_main = __la_win_entry_in_posix_pathseparator(entry_original); if (entry_main == entry_original) Modified: head/contrib/libarchive/libarchive/archive_write_set_format_ustar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_ustar.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_write_set_format_ustar.c Tue Dec 6 01:35:27 2016 (r309590) @@ -114,9 +114,9 @@ static const char template_header[] = { '0','0','0','0','0','0', ' ','\0', /* gid, space-null termination: 8 bytes */ '0','0','0','0','0','0', ' ','\0', - /* size, space termation: 12 bytes */ + /* size, space termination: 12 bytes */ '0','0','0','0','0','0','0','0','0','0','0', ' ', - /* mtime, space termation: 12 bytes */ + /* mtime, space termination: 12 bytes */ '0','0','0','0','0','0','0','0','0','0','0', ' ', /* Initial checksum value: 8 spaces */ ' ',' ',' ',' ',' ',' ',' ',' ', @@ -336,7 +336,7 @@ archive_write_ustar_header(struct archiv } #if defined(_WIN32) && !defined(__CYGWIN__) - /* Make sure the path separators in pahtname, hardlink and symlink + /* Make sure the path separators in pathname, hardlink and symlink * are all slash '/', not the Windows path separator '\'. */ entry_main = __la_win_entry_in_posix_pathseparator(entry); if (entry_main == NULL) { Modified: head/contrib/libarchive/libarchive/archive_write_set_format_v7tar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_v7tar.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_write_set_format_v7tar.c Tue Dec 6 01:35:27 2016 (r309590) @@ -98,9 +98,9 @@ static const char template_header[] = { '0','0','0','0','0','0', ' ','\0', /* gid, space-null termination: 8 bytes */ '0','0','0','0','0','0', ' ','\0', - /* size, space termation: 12 bytes */ + /* size, space termination: 12 bytes */ '0','0','0','0','0','0','0','0','0','0','0', ' ', - /* mtime, space termation: 12 bytes */ + /* mtime, space termination: 12 bytes */ '0','0','0','0','0','0','0','0','0','0','0', ' ', /* Initial checksum value: 8 spaces */ ' ',' ',' ',' ',' ',' ',' ',' ', @@ -314,7 +314,7 @@ archive_write_v7tar_header(struct archiv } #if defined(_WIN32) && !defined(__CYGWIN__) - /* Make sure the path separators in pahtname, hardlink and symlink + /* Make sure the path separators in pathname, hardlink and symlink * are all slash '/', not the Windows path separator '\'. */ entry_main = __la_win_entry_in_posix_pathseparator(entry); if (entry_main == NULL) { Modified: head/contrib/libarchive/libarchive/archive_write_set_format_zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_zip.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/archive_write_set_format_zip.c Tue Dec 6 01:35:27 2016 (r309590) @@ -592,7 +592,7 @@ archive_write_zip_header(struct archive_ #if defined(_WIN32) && !defined(__CYGWIN__) - /* Make sure the path separators in pahtname, hardlink and symlink + /* Make sure the path separators in pathname, hardlink and symlink * are all slash '/', not the Windows path separator '\'. */ zip->entry = __la_win_entry_in_posix_pathseparator(entry); if (zip->entry == entry) Modified: head/contrib/libarchive/libarchive/test/main.c ============================================================================== --- head/contrib/libarchive/libarchive/test/main.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/test/main.c Tue Dec 6 01:35:27 2016 (r309590) @@ -519,7 +519,7 @@ _utf8_to_unicode(uint32_t *pwc, const ch return (0); /* Standard: return 0 for end-of-string. */ cnt = utf8_count[ch]; - /* Invalide sequence or there are not plenty bytes. */ + /* Invalid sequence or there are not plenty bytes. */ if (n < (size_t)cnt) return (-1); @@ -558,7 +558,7 @@ _utf8_to_unicode(uint32_t *pwc, const ch return (-1); } - /* The code point larger than 0x10FFFF is not leagal + /* The code point larger than 0x10FFFF is not legal * Unicode values. */ if (wc > 0x10FFFF) return (-1); Modified: head/contrib/libarchive/libarchive/test/test_archive_cmdline.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_archive_cmdline.c Tue Dec 6 00:39:00 2016 (r309589) +++ head/contrib/libarchive/libarchive/test/test_archive_cmdline.c Tue Dec 6 01:35:27 2016 (r309590) @@ -66,7 +66,7 @@ DEFINE_TEST(test_archive_cmdline) assertEqualString("gzip", cl->argv[0]); assertEqualInt(ARCHIVE_OK, __archive_cmdline_free(cl)); - /* A command line includes space characer. */ + /* A command line includes space character. */ assert((cl = __archive_cmdline_allocate()) != NULL); if (cl == NULL) return; @@ -78,7 +78,7 @@ DEFINE_TEST(test_archive_cmdline) assertEqualString("gzip ", cl->argv[0]); assertEqualInt(ARCHIVE_OK, __archive_cmdline_free(cl)); - /* A command line includes space characer: pattern 2.*/ + /* A command line includes space character: pattern 2.*/ assert((cl = __archive_cmdline_allocate()) != NULL); if (cl == NULL) return; @@ -90,7 +90,7 @@ DEFINE_TEST(test_archive_cmdline) assertEqualString("gzip x", cl->argv[0]); assertEqualInt(ARCHIVE_OK, __archive_cmdline_free(cl)); - /* A command line includes space characer: pattern 3.*/ + /* A command line includes space character: pattern 3.*/ assert((cl = __archive_cmdline_allocate()) != NULL); if (cl == NULL) return; @@ -103,7 +103,7 @@ DEFINE_TEST(test_archive_cmdline) assertEqualString("gzip x s ", cl->argv[0]); assertEqualInt(ARCHIVE_OK, __archive_cmdline_free(cl)); - /* A command line includes space characer: pattern 4.*/ + /* A command line includes space character: pattern 4.*/ assert((cl = __archive_cmdline_allocate()) != NULL); if (cl == NULL) return; Copied: head/contrib/libarchive/libarchive/test/test_compat_plexus_archiver_tar.c (from r309587, vendor/libarchive/dist/libarchive/test/test_compat_plexus_archiver_tar.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/test/test_compat_plexus_archiver_tar.c Tue Dec 6 01:35:27 2016 (r309590, copy of r309587, vendor/libarchive/dist/libarchive/test/test_compat_plexus_archiver_tar.c) @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2016 Martin Matuska + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD"); + +/* + * Verify our ability to read sample files created by plexus-archiver version + * 2.6.2 and lower (project switched to Apache Commons Compress with 2.6.3). + * + * These files may have tar entries with uid and gid header fields filled with + * spaces without any octal digit. + */ + +DEFINE_TEST(test_compat_plexus_archiver_tar) +{ + char name[] = "test_compat_plexus_archiver_tar.tar"; + struct archive_entry *ae; + struct archive *a; + int r; + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + extract_reference_file(name); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, + 10240)); + + /* Read first entry. */ + assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae)); + if (r != ARCHIVE_OK) { + archive_read_free(a); + return; + } + assertEqualString("commons-logging-1.2/NOTICE.txt", + archive_entry_pathname(ae)); + assertEqualInt(1404583896, archive_entry_mtime(ae)); + assertEqualInt(0100664, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_uid(ae)); + assertEqualInt(0, archive_entry_gid(ae)); + + /* Verify that the format detection worked. */ + assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_NONE); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} Copied: head/contrib/libarchive/libarchive/test/test_compat_plexus_archiver_tar.tar.uu (from r309587, vendor/libarchive/dist/libarchive/test/test_compat_plexus_archiver_tar.tar.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/test/test_compat_plexus_archiver_tar.tar.uu Tue Dec 6 01:35:27 2016 (r309590, copy of r309587, vendor/libarchive/dist/libarchive/test/test_compat_plexus_archiver_tar.tar.uu) @@ -0,0 +1,49 @@ +begin 644 test_compat_plexus_archiver_tar.tar +M8V]M;6]N