From owner-svn-src-head@freebsd.org Sun Dec 13 16:26:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 435A14BDADC; Sun, 13 Dec 2020 16:26:39 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cv8zg11FRz4cKc; Sun, 13 Dec 2020 16:26:39 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1143F12B82; Sun, 13 Dec 2020 16:26:39 +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 0BDGQcmI013021; Sun, 13 Dec 2020 16:26:38 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0BDGQbrh013014; Sun, 13 Dec 2020 16:26:37 GMT (envelope-from mm@FreeBSD.org) Message-Id: <202012131626.0BDGQbrh013014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Sun, 13 Dec 2020 16:26:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368608 - in head: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive X-SVN-Group: head X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in head: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive X-SVN-Commit-Revision: 368608 X-SVN-Commit-Repository: base 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.34 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: Sun, 13 Dec 2020 16:26:39 -0000 Author: mm Date: Sun Dec 13 16:26:37 2020 New Revision: 368608 URL: https://svnweb.freebsd.org/changeset/base/368608 Log: MFV r368607: Sync libarchive with vendor. Vendor changes: Issue #1461: Unbreak build without lzma Issue #1462: warc reader: Fix build with gcc11 Issue #1463: Fix code compatibility in test_archive_read_support.c Issue #1464: Use built-in strnlen on platforms where not available Issue #1465: warc reader: fix undefined behaviour in deconst() function MFC after: 3 days X-MFC-With: 368234 Modified: head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c head/contrib/libarchive/libarchive/archive_read_support_format_warc.c head/contrib/libarchive/libarchive/archive_read_support_format_zip.c head/contrib/libarchive/libarchive/test/test_archive_read_support.c head/lib/libarchive/config_freebsd.h Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Sun Dec 13 15:29:19 2020 (r368607) +++ head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Sun Dec 13 16:26:37 2020 (r368608) @@ -136,6 +136,9 @@ static int skip(struct archive_read *a); static int read_header(struct archive_read *, struct archive_entry *); static int64_t mtree_atol(char **, int base); +#ifndef HAVE_STRNLEN +static size_t mtree_strnlen(const char *, size_t); +#endif /* * There's no standard for TIME_T_MAX/TIME_T_MIN. So we compute them @@ -187,6 +190,24 @@ get_time_t_min(void) #endif } +#ifdef HAVE_STRNLEN +#define mtree_strnlen(a,b) strnlen(a,b) +#else +static size_t +mtree_strnlen(const char *p, size_t maxlen) +{ + size_t i; + + for (i = 0; i <= maxlen; i++) { + if (p[i] == 0) + break; + } + if (i > maxlen) + return (-1);/* invalid */ + return (i); +} +#endif + static int archive_read_format_mtree_options(struct archive_read *a, const char *key, const char *val) @@ -1540,7 +1561,7 @@ parse_digest(struct archive_read *a, struct archive_en len *= 2; - if (strnlen(digest, len+1) != len) { + if (mtree_strnlen(digest, len+1) != len) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "incorrect digest length, ignoring"); return ARCHIVE_WARN; Modified: head/contrib/libarchive/libarchive/archive_read_support_format_warc.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_warc.c Sun Dec 13 15:29:19 2020 (r368607) +++ head/contrib/libarchive/libarchive/archive_read_support_format_warc.c Sun Dec 13 16:26:37 2020 (r368608) @@ -127,7 +127,7 @@ static int _warc_skip(struct archive_read *a); static int _warc_rdhdr(struct archive_read *a, struct archive_entry *e); /* private routines */ -static unsigned int _warc_rdver(const char buf[10], size_t bsz); +static unsigned int _warc_rdver(const char *buf, size_t bsz); static unsigned int _warc_rdtyp(const char *buf, size_t bsz); static warc_string_t _warc_rduri(const char *buf, size_t bsz); static ssize_t _warc_rdlen(const char *buf, size_t bsz); @@ -443,7 +443,7 @@ _warc_skip(struct archive_read *a) static void* deconst(const void *c) { - return (char *)0x1 + (((const char *)c) - (const char *)0x1); + return (void *)(uintptr_t)c; } static char* Modified: head/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Sun Dec 13 15:29:19 2020 (r368607) +++ head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Sun Dec 13 16:26:37 2020 (r368608) @@ -899,6 +899,7 @@ process_extra(struct archive_read *a, struct archive_e return ARCHIVE_OK; } +#if HAVE_LZMA_H && HAVE_LIBLZMA /* * Auxiliary function to uncompress data chunk from zipx archive * (zip with lzma compression). @@ -971,6 +972,7 @@ zipx_lzma_uncompress_buffer(const char *compressed_buf free(lzma_alone_compressed_buffer); return status; } +#endif /* * Assumes file pointer is at beginning of local file header. Modified: head/contrib/libarchive/libarchive/test/test_archive_read_support.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_archive_read_support.c Sun Dec 13 15:29:19 2020 (r368607) +++ head/contrib/libarchive/libarchive/test/test_archive_read_support.c Sun Dec 13 16:26:37 2020 (r368608) @@ -126,7 +126,9 @@ DEFINE_TEST(test_archive_read_support) ARCHIVE_FORMAT_WARC, ARCHIVE_FORMAT_RAR_V5, }; - for (unsigned i = 0; i < sizeof(format_codes) / sizeof(int); i++) { + unsigned int i; + + for (i = 0; i < sizeof(format_codes) / sizeof(int); i++) { format_code = format_codes[i]; test_filter_or_format(format_code_enabler); test_filter_or_format(format_code_setter); Modified: head/lib/libarchive/config_freebsd.h ============================================================================== --- head/lib/libarchive/config_freebsd.h Sun Dec 13 15:29:19 2020 (r368607) +++ head/lib/libarchive/config_freebsd.h Sun Dec 13 16:26:37 2020 (r368608) @@ -183,6 +183,7 @@ #define HAVE_STRFTIME 1 #define HAVE_STRINGS_H 1 #define HAVE_STRING_H 1 +#define HAVE_STRNLEN 1 #define HAVE_STRRCHR 1 #define HAVE_STRUCT_STATFS_F_NAMEMAX 1 #define HAVE_STRUCT_STAT_ST_BIRTHTIME 1