Date: Sat, 28 Dec 2019 23:40:32 +0000 (UTC) From: Martin Matuska <mm@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r356163 - in vendor/libarchive/dist: . .github/workflows build/ci/cirrus_ci build/ci/github_actions examples/minitar libarchive libarchive/test test_utils Message-ID: <201912282340.xBSNeWfu025439@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mm Date: Sat Dec 28 23:40:32 2019 New Revision: 356163 URL: https://svnweb.freebsd.org/changeset/base/356163 Log: Update vendor/libarchive/dist to git 1dae5a549fe4ab99fd3a49a9edcf897a7b2b1844 Relevant vendor changes: Issue #351: Refactor and implement private state logic for write filters PR #1252: RAR5 reader - verify window size for solid files (OSS-Fuzz 15482) PR #1255: zip writer - don't append unused NUL for directories PR #1260: Fix sparse file offset overflow on 32-bit systems PR #1263: UNICODE filename support for reading lha/lzh format Issue #1276: Bugfix and optimize archive_wstring_append_from_mbs() PR #1288: Add the "xattrhdr" option to pax write options PR #1295: 7z reader - fix reading archives with digests in PackInfo PR #1296: RAR5 reader - verify window size for multivolume archives PR #1297: ZIP reader - support LZMA_STREAM_END marker in 'lzma alone' files Issue #1298: Fix a heap-buffer-overflow in archive_string_append_from_wcs() OSS-Fuzz 19360, 19362: LHA reader - plug two memory leaks on error Fix possible off-by-one when dealing with readlink(2) Added: vendor/libarchive/dist/build/ci/github_actions/ vendor/libarchive/dist/build/ci/github_actions/ci.cmd (contents, props changed) vendor/libarchive/dist/build/ci/github_actions/macos.sh (contents, props changed) vendor/libarchive/dist/libarchive/test/test_pax_xattr_header.c (contents, props changed) vendor/libarchive/dist/libarchive/test/test_pax_xattr_header_all.tar.uu vendor/libarchive/dist/libarchive/test/test_pax_xattr_header_libarchive.tar.uu vendor/libarchive/dist/libarchive/test/test_pax_xattr_header_schily.tar.uu vendor/libarchive/dist/libarchive/test/test_read_format_7zip_packinfo_digests.7z.uu vendor/libarchive/dist/libarchive/test/test_read_format_7zip_packinfo_digests.c (contents, props changed) vendor/libarchive/dist/libarchive/test/test_read_format_lha_filename_utf16.c (contents, props changed) vendor/libarchive/dist/libarchive/test/test_read_format_lha_filename_utf16.lzh.uu vendor/libarchive/dist/libarchive/test/test_read_format_rar5_different_solid_window_size.rar.uu vendor/libarchive/dist/libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu Modified: vendor/libarchive/dist/.cirrus.yml vendor/libarchive/dist/.github/workflows/ci.yml vendor/libarchive/dist/Makefile.am vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc30.distcheck vendor/libarchive/dist/configure.ac vendor/libarchive/dist/examples/minitar/minitar.c vendor/libarchive/dist/libarchive/archive_entry.h vendor/libarchive/dist/libarchive/archive_entry_acl.3 vendor/libarchive/dist/libarchive/archive_hmac.c vendor/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c vendor/libarchive/dist/libarchive/archive_read_disk_posix.c vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c vendor/libarchive/dist/libarchive/archive_read_support_format_rar5.c vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c vendor/libarchive/dist/libarchive/archive_string.c vendor/libarchive/dist/libarchive/archive_write.c vendor/libarchive/dist/libarchive/archive_write_add_filter_b64encode.c vendor/libarchive/dist/libarchive/archive_write_add_filter_bzip2.c vendor/libarchive/dist/libarchive/archive_write_add_filter_compress.c vendor/libarchive/dist/libarchive/archive_write_add_filter_gzip.c vendor/libarchive/dist/libarchive/archive_write_add_filter_lz4.c vendor/libarchive/dist/libarchive/archive_write_add_filter_lzop.c vendor/libarchive/dist/libarchive/archive_write_add_filter_program.c vendor/libarchive/dist/libarchive/archive_write_add_filter_uuencode.c vendor/libarchive/dist/libarchive/archive_write_add_filter_xz.c vendor/libarchive/dist/libarchive/archive_write_add_filter_zstd.c vendor/libarchive/dist/libarchive/archive_write_disk_posix.c vendor/libarchive/dist/libarchive/archive_write_private.h vendor/libarchive/dist/libarchive/archive_write_set_format_pax.c vendor/libarchive/dist/libarchive/archive_write_set_format_zip.c vendor/libarchive/dist/libarchive/archive_write_set_options.3 vendor/libarchive/dist/libarchive/test/CMakeLists.txt vendor/libarchive/dist/libarchive/test/test_open_failure.c vendor/libarchive/dist/libarchive/test/test_open_fd.c vendor/libarchive/dist/libarchive/test/test_read_disk_directory_traversals.c vendor/libarchive/dist/libarchive/test/test_read_format_rar5.c vendor/libarchive/dist/libarchive/test/test_sparse_basic.c vendor/libarchive/dist/test_utils/test_main.c Modified: vendor/libarchive/dist/.cirrus.yml ============================================================================== --- vendor/libarchive/dist/.cirrus.yml Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/.cirrus.yml Sat Dec 28 23:40:32 2019 (r356163) @@ -10,9 +10,9 @@ FreeBSD_task: BS: cmake matrix: freebsd_instance: - image: freebsd-12-0-release-amd64 + image_family: freebsd-12-1 freebsd_instance: - image: freebsd-11-2-release-amd64 + image: freebsd-11-3-stable-amd64-v20190801 prepare_script: - ./build/ci/cirrus_ci/ci.sh prepare configure_script: @@ -26,28 +26,6 @@ FreeBSD_task: install_script: - ./build/ci/build.sh -a install -MacOS_task: - matrix: - env: - BS: autotools - env: - BS: cmake - matrix: - osx_instance: - image: mojave-xcode-10.2 - prepare_script: - - ./build/ci/cirrus_ci/ci.sh prepare - configure_script: - - ./build/ci/build.sh -a autogen - - ./build/ci/build.sh -a configure - build_script: - - ./build/ci/build.sh -a build - test_script: - - ./build/ci/build.sh -a test - - ./build/ci/cirrus_ci/ci.sh test - install_script: - - ./build/ci/build.sh -a install - Fedora_30_task: container: dockerfile: build/ci/cirrus_ci/Dockerfile.fc30 @@ -65,51 +43,6 @@ Fedora_30_task: - ./build/ci/build.sh -a test install_script: - ./build/ci/build.sh -a install - -Fedora_30_distcheck_task: - container: - dockerfile: build/ci/cirrus_ci/Dockerfile.fc30.distcheck - env: - BS: autotools - configure_script: - - ./build/ci/build.sh -a autogen - - ./build/ci/build.sh -a configure - distcheck_script: - - ./build/ci/build.sh -a distcheck - -Windows_MSVC_task: - windows_container: - dockerfile: build/ci/cirrus_ci/Dockerfile.msvc - os_version: 2019 - env: - BE: msvc - configure_script: - - build\ci\cirrus_ci\ci.cmd configure - build_script: - - build\ci\cirrus_ci\ci.cmd build - test_script: - - build\ci\cirrus_ci\ci.cmd test - instal_script: - - build\ci\cirrus_ci\ci.cmd install - -Windows_MinGW_task: - windows_container: - image: cirrusci/windowsservercore:2019 - os_version: 2019 - env: - BE: mingw-gcc - prepare_script: - - build\ci\cirrus_ci\ci.cmd prepare - deplibs_script: - - build\ci\cirrus_ci\ci.cmd deplibs - configure_script: - - build\ci\cirrus_ci\ci.cmd configure - build_script: - - build\ci\cirrus_ci\ci.cmd build - test_script: - - build\ci\cirrus_ci\ci.cmd test - install_script: - - build\ci\cirrus_ci\ci.cmd install Windows_Cygwin_task: windows_container: Modified: vendor/libarchive/dist/.github/workflows/ci.yml ============================================================================== --- vendor/libarchive/dist/.github/workflows/ci.yml Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/.github/workflows/ci.yml Sat Dec 28 23:40:32 2019 (r356163) @@ -1,16 +1,44 @@ -name: Ubuntu +name: CI on: [push, pull_request] jobs: - Build-and-test: + MacOS: + runs-on: macos-latest + strategy: + matrix: + bs: [autotools, cmake] + steps: + - uses: actions/checkout@master + - name: Install dependencies + run: ./build/ci/github_actions/macos.sh prepare + - name: Autogen + run: ./build/ci/build.sh -a autogen + env: + BS: ${{ matrix.bs }} + - name: Configure + run: ./build/ci/build.sh -a configure + env: + BS: ${{ matrix.bs }} + - name: Build + run: ./build/ci/build.sh -a build + env: + BS: ${{ matrix.bs }} + - name: Test + run: ./build/ci/build.sh -a test + env: + BS: ${{ matrix.bs }} + SKIP_OPEN_FD_ERR_TEST: 1 + - name: Install + run: ./build/ci/build.sh -a install + env: + BS: ${{ matrix.bs }} + Ubuntu: runs-on: ubuntu-latest - strategy: matrix: bs: [autotools, cmake] - steps: - uses: actions/checkout@master - name: Install dependencies @@ -31,7 +59,56 @@ jobs: run: ./build/ci/build.sh -a test env: BS: ${{ matrix.bs }} + SKIP_OPEN_FD_ERR_TEST: 1 - name: Install run: ./build/ci/build.sh -a install env: BS: ${{ matrix.bs }} + + Ubuntu-distcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Install dependencies + run: sudo apt-get install -y build-essential cmake libssl-dev libacl1-dev libbz2-dev liblzma-dev libzip-dev liblz4-dev libzstd-dev lzop groff ghostscript + - name: Autogen + run: ./build/ci/build.sh -a autogen + - name: Configure + run: ./build/ci/build.sh -a configure + - name: Distcheck + run: ./build/ci/build.sh -a distcheck + env: + SKIP_OPEN_FD_ERR_TEST: 1 + + Windows: + runs-on: windows-latest + strategy: + matrix: + be: [mingw-gcc, msvc] + steps: + - uses: actions/checkout@master + - name: Install dependencies + run: ./build/ci/github_actions/ci.cmd deplibs + shell: cmd + env: + BE: ${{ matrix.be }} + - name: Configure + run: ./build/ci/github_actions/ci.cmd configure + shell: cmd + env: + BE: ${{ matrix.be }} + - name: Build + run: ./build/ci/github_actions/ci.cmd build + shell: cmd + env: + BE: ${{ matrix.be }} + - name: Test + run: ./build/ci/github_actions/ci.cmd test + shell: cmd + env: + BE: ${{ matrix.be }} + - name: Install + run: ./build/ci/github_actions/ci.cmd install + shell: cmd + env: + BE: ${{ matrix.be }} Modified: vendor/libarchive/dist/Makefile.am ============================================================================== --- vendor/libarchive/dist/Makefile.am Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/Makefile.am Sat Dec 28 23:40:32 2019 (r356163) @@ -429,6 +429,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_open_file.c \ libarchive/test/test_open_filename.c \ libarchive/test/test_pax_filename_encoding.c \ + libarchive/test/test_pax_xattr_header.c \ libarchive/test/test_read_data_large.c \ libarchive/test/test_read_disk.c \ libarchive/test/test_read_disk_directory_traversals.c \ @@ -448,6 +449,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_format_7zip_encryption_partially.c \ libarchive/test/test_read_format_7zip_encryption_header.c \ libarchive/test/test_read_format_7zip_malformed.c \ + libarchive/test/test_read_format_7zip_packinfo_digests.c \ libarchive/test/test_read_format_ar.c \ libarchive/test/test_read_format_cab.c \ libarchive/test/test_read_format_cab_filename.c \ @@ -488,6 +490,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_format_lha.c \ libarchive/test/test_read_format_lha_bugfix_0.c \ libarchive/test/test_read_format_lha_filename.c \ + libarchive/test/test_read_format_lha_filename_utf16.c \ libarchive/test/test_read_format_mtree.c \ libarchive/test/test_read_format_mtree_crash747.c \ libarchive/test/test_read_format_pax_bz2.c \ @@ -701,6 +704,9 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_fuzz.lzh.uu \ libarchive/test/test_fuzz_1.iso.Z.uu \ libarchive/test/test_pax_filename_encoding.tar.uu \ + libarchive/test/test_pax_xattr_header_all.tar.uu \ + libarchive/test/test_pax_xattr_header_libarchive.tar.uu \ + libarchive/test/test_pax_xattr_header_schily.tar.uu \ libarchive/test/test_rar_multivolume_multiple_files.part1.rar.uu \ libarchive/test/test_rar_multivolume_multiple_files.part2.rar.uu \ libarchive/test/test_rar_multivolume_multiple_files.part3.rar.uu \ @@ -757,6 +763,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_7zip_lzma2.7z.uu \ libarchive/test/test_read_format_7zip_malformed.7z.uu \ libarchive/test/test_read_format_7zip_malformed2.7z.uu \ + libarchive/test/test_read_format_7zip_packinfo_digests.7z.uu \ libarchive/test/test_read_format_7zip_ppmd.7z.uu \ libarchive/test/test_read_format_7zip_symbolic_name.7z.uu \ libarchive/test/test_read_format_ar.ar.uu \ @@ -798,6 +805,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_iso_zisofs.iso.Z.uu \ libarchive/test/test_read_format_lha_bugfix_0.lzh.uu \ libarchive/test/test_read_format_lha_filename_cp932.lzh.uu \ + libarchive/test/test_read_format_lha_filename_utf16.lzh.uu \ libarchive/test/test_read_format_lha_header0.lzh.uu \ libarchive/test/test_read_format_lha_header1.lzh.uu \ libarchive/test/test_read_format_lha_header2.lzh.uu \ @@ -835,6 +843,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_rar5_blake2.rar.uu \ libarchive/test/test_read_format_rar5_compressed.rar.uu \ libarchive/test/test_read_format_rar5_different_window_size.rar.uu \ + libarchive/test/test_read_format_rar5_different_solid_window_size.rar.uu \ libarchive/test/test_read_format_rar5_distance_overflow.rar.uu \ libarchive/test/test_read_format_rar5_extra_field_version.rar.uu \ libarchive/test/test_read_format_rar5_fileattr.rar.uu \ @@ -866,6 +875,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_rar5_truncated_huff.rar.uu \ libarchive/test/test_read_format_rar5_win32.rar.uu \ libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu \ + libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu \ libarchive/test/test_read_format_raw.bufr.uu \ libarchive/test/test_read_format_raw.data.gz.uu \ libarchive/test/test_read_format_raw.data.Z.uu \ Modified: vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc30.distcheck ============================================================================== --- vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc30.distcheck Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc30.distcheck Sat Dec 28 23:40:32 2019 (r356163) @@ -1,3 +1,3 @@ FROM fedora:30 -RUN dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison sharutils pkgconf libacl-devel libasan librichacl-devel bzip2-devel libzip-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel groff ghostscript +RUN dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison sharutils pkgconf libacl-devel libasan librichacl-devel bzip2-devel libzip-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel groff ghostscript xz zip Added: vendor/libarchive/dist/build/ci/github_actions/ci.cmd ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/build/ci/github_actions/ci.cmd Sat Dec 28 23:40:32 2019 (r356163) @@ -0,0 +1,79 @@ +@ECHO OFF +SET ZLIB_VERSION=1.2.11 +IF NOT "%BE%"=="mingw-gcc" ( + IF NOT "%BE%"=="msvc" ( + ECHO Environment variable BE must be mingw-gcc or msvc + EXIT /b 1 + ) +) + +IF "%1"=="deplibs" ( + IF NOT EXIST build_ci\libs ( + MKDIR build_ci\libs + ) + CD build_ci\libs + IF NOT EXIST zlib-%ZLIB_VERSION%.tar.gz ( + curl -o zlib-%ZLIB_VERSION%.tar.gz https://www.zlib.net/zlib-%ZLIB_VERSION%.tar.gz + ) + IF NOT EXIST zlib-%ZLIB_VERSION% ( + tar -x -z -f zlib-%ZLIB_VERSION%.tar.gz + ) + CD zlib-%ZLIB_VERSION% + IF "%BE%"=="mingw-gcc" ( + SET PATH=C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin + cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" . || EXIT /b 1 + mingw32-make || EXIT /b 1 + mingw32-make test || EXIT /b 1 + mingw32-make install || EXIT /b 1 + ) ELSE IF "%BE%"=="msvc" ( + cmake -G "Visual Studio 16 2019" . || EXIT /b 1 + cmake --build . --target ALL_BUILD --config Release || EXIT /b 1 + cmake --build . --target RUN_TESTS --config Release || EXIT /b 1 + cmake --build . --target INSTALL --config Release || EXIT /b 1 + ) +) ELSE IF "%1%"=="configure" ( + IF "%BE%"=="mingw-gcc" ( + SET PATH=C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin + MKDIR build_ci\cmake + CD build_ci\cmake + cmake -G "MinGW Makefiles" ..\.. || EXIT /b 1 + ) ELSE IF "%BE%"=="msvc" ( + MKDIR build_ci\cmake + CD build_ci\cmake + cmake -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE="Release" ..\.. || EXIT /b 1 + ) +) ELSE IF "%1%"=="build" ( + IF "%BE%"=="mingw-gcc" ( + SET PATH=C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin + CD build_ci\cmake + mingw32-make || EXIT /b 1 + ) ELSE IF "%BE%"=="msvc" ( + CD build_ci\cmake + cmake --build . --target ALL_BUILD --config Release + ) +) ELSE IF "%1%"=="test" ( + IF "%BE%"=="mingw-gcc" ( + SET PATH=C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin + COPY "C:\Program Files (x86)\zlib\bin\libzlib.dll" build_ci\cmake\bin\ + CD build_ci\cmake + SET SKIP_TEST_SPARSE=1 + mingw32-make test + ) ELSE IF "%BE%"=="msvc" ( + ECHO "Skipping tests on this platform" + EXIT /b 0 + REM CD build_ci\cmake + REM cmake --build . --target RUN_TESTS --config Release + ) +) ELSE IF "%1%"=="install" ( + IF "%BE%"=="mingw-gcc" ( + SET PATH=C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin + CD build_ci\cmake + mingw32-make install DESTDIR=%cd%\destdir + ) ELSE IF "%BE%"=="msvc" ( + cmake --build . --target INSTALL --config Release + ) +) ELSE ( + ECHO "Usage: %0% deplibs|configure|build|test|install" + @EXIT /b 0 +) +@EXIT /b 0 Added: vendor/libarchive/dist/build/ci/github_actions/macos.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/build/ci/github_actions/macos.sh Sat Dec 28 23:40:32 2019 (r356163) @@ -0,0 +1,10 @@ +#!/bin/sh +if [ "$1" = "prepare" ] +then + set -x -e + brew update > /dev/null + for pkg in autoconf automake libtool pkg-config cmake xz lz4 zstd + do + brew list $pkg > /dev/null && brew upgrade $pkg || brew install $pkg + done +fi Modified: vendor/libarchive/dist/configure.ac ============================================================================== --- vendor/libarchive/dist/configure.ac Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/configure.ac Sat Dec 28 23:40:32 2019 (r356163) @@ -26,7 +26,7 @@ AC_CONFIG_AUX_DIR([build/autoconf]) # M4 scripts AC_CONFIG_MACRO_DIR([build/autoconf]) # Must follow AC_CONFIG macros above... -AM_INIT_AUTOMAKE() +AM_INIT_AUTOMAKE([1.11 dist-xz dist-zip]) AM_MAINTAINER_MODE([enable]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) Modified: vendor/libarchive/dist/examples/minitar/minitar.c ============================================================================== --- vendor/libarchive/dist/examples/minitar/minitar.c Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/examples/minitar/minitar.c Sat Dec 28 23:40:32 2019 (r356163) @@ -398,6 +398,9 @@ extract(const char *filename, int do_extract, int flag } archive_read_close(a); archive_read_free(a); + + archive_write_close(ext); + archive_write_free(ext); exit(0); } Modified: vendor/libarchive/dist/libarchive/archive_entry.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive_entry.h Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/libarchive/archive_entry.h Sat Dec 28 23:40:32 2019 (r356163) @@ -524,9 +524,6 @@ __LA_DECL int archive_entry_acl_reset(struct archive_ __LA_DECL int archive_entry_acl_next(struct archive_entry *, int /* want_type */, int * /* type */, int * /* permset */, int * /* tag */, int * /* qual */, const char ** /* name */); -__LA_DECL int archive_entry_acl_next_w(struct archive_entry *, int /* want_type */, - int * /* type */, int * /* permset */, int * /* tag */, - int * /* qual */, const wchar_t ** /* name */); /* * Construct a text-format ACL. The flags argument is a bitmask that Modified: vendor/libarchive/dist/libarchive/archive_entry_acl.3 ============================================================================== --- vendor/libarchive/dist/libarchive/archive_entry_acl.3 Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/libarchive/archive_entry_acl.3 Sat Dec 28 23:40:32 2019 (r356163) @@ -34,7 +34,6 @@ .Nm archive_entry_acl_from_text , .Nm archive_entry_acl_from_text_w , .Nm archive_entry_acl_next , -.Nm archive_entry_acl_next_w , .Nm archive_entry_acl_reset , .Nm archive_entry_acl_to_text , .Nm archive_entry_acl_to_text_w , @@ -89,16 +88,6 @@ Streaming Archive Library (libarchive, -larchive) .Fa "const char **ret_name" .Fc .Ft int -.Fo archive_entry_acl_next_w -.Fa "struct archive_entry *a" -.Fa "int type" -.Fa "int *ret_type" -.Fa "int *ret_permset" -.Fa "int *ret_tag" -.Fa "int *ret_qual" -.Fa "const wchar_t **ret_name" -.Fc -.Ft int .Fn archive_entry_acl_reset "struct archive_entry *a" "int type" .Ft char * .Fo archive_entry_acl_to_text @@ -349,8 +338,6 @@ character are skipped. .Pp .Fn archive_entry_acl_next -and -.Fn archive_entry_acl_next_w return the next entry of the ACL list. This functions may only be called after .Fn archive_entry_acl_reset @@ -358,9 +345,7 @@ has indicated the presence of extended ACL entries. .Pp .Fn archive_entry_acl_reset prepare reading the list of ACL entries with -.Fn archive_entry_acl_next -or -.Fn archive_entry_acl_next_w . +.Fn archive_entry_acl_next . The function returns 0 if no non-extended ACLs are found. In this case, the access permissions should be obtained by .Xr archive_entry_mode 3 @@ -447,9 +432,7 @@ if all entries were successfully parsed and if one or more entries were invalid or non-parseable. .Pp .Fn archive_entry_acl_next -and -.Fn archive_entry_acl_next_w -return +returns .Dv ARCHIVE_OK on success, .Dv ARCHIVE_EOF Modified: vendor/libarchive/dist/libarchive/archive_hmac.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_hmac.c Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/libarchive/archive_hmac.c Sat Dec 28 23:40:32 2019 (r356163) @@ -83,7 +83,9 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) static int __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) { +#ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wcast-qual" +#endif BCRYPT_ALG_HANDLE hAlg; BCRYPT_HASH_HANDLE hHash; DWORD hash_len; Modified: vendor/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c Sat Dec 28 23:40:32 2019 (r356163) @@ -249,11 +249,11 @@ archive_read_disk_entry_from_file(struct archive *_a, #if defined(HAVE_READLINK) || defined(HAVE_READLINKAT) if (S_ISLNK(st->st_mode)) { - size_t linkbuffer_len = st->st_size + 1; + size_t linkbuffer_len = st->st_size; char *linkbuffer; int lnklen; - linkbuffer = malloc(linkbuffer_len); + linkbuffer = malloc(linkbuffer_len + 1); if (linkbuffer == NULL) { archive_set_error(&a->archive, ENOMEM, "Couldn't read link data"); @@ -280,7 +280,7 @@ archive_read_disk_entry_from_file(struct archive *_a, free(linkbuffer); return (ARCHIVE_FAILED); } - linkbuffer[lnklen] = 0; + linkbuffer[lnklen] = '\0'; archive_entry_set_symlink(entry, linkbuffer); free(linkbuffer); } Modified: vendor/libarchive/dist/libarchive/archive_read_disk_posix.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_disk_posix.c Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/libarchive/archive_read_disk_posix.c Sat Dec 28 23:40:32 2019 (r356163) @@ -694,6 +694,7 @@ _archive_read_data_block(struct archive *_a, const voi struct tree *t = a->tree; int r; ssize_t bytes; + int64_t sparse_bytes; size_t buffbytes; int empty_sparse_region = 0; @@ -792,9 +793,9 @@ _archive_read_data_block(struct archive *_a, const voi a->archive.state = ARCHIVE_STATE_FATAL; goto abort_read_data; } - bytes = t->current_sparse->offset - t->entry_total; - t->entry_remaining_bytes -= bytes; - t->entry_total += bytes; + sparse_bytes = t->current_sparse->offset - t->entry_total; + t->entry_remaining_bytes -= sparse_bytes; + t->entry_total += sparse_bytes; } /* @@ -2172,7 +2173,7 @@ tree_reopen(struct tree *t, const char *path, int rest #elif defined(O_SEARCH) /* SunOS */ const int o_flag = O_SEARCH; -#elif defined(O_EXEC) +#elif defined(__FreeBSD__) && defined(O_EXEC) /* FreeBSD */ const int o_flag = O_EXEC; #endif @@ -2198,7 +2199,8 @@ tree_reopen(struct tree *t, const char *path, int rest t->stack->flags = needsFirstVisit; t->maxOpenCount = t->openCount = 1; t->initial_dir_fd = open(".", O_RDONLY | O_CLOEXEC); -#if defined(O_PATH) || defined(O_SEARCH) || defined(O_EXEC) +#if defined(O_PATH) || defined(O_SEARCH) || \ + (defined(__FreeBSD__) && defined(O_EXEC)) /* * Most likely reason to fail opening "." is that it's not readable, * so try again for execute. The consequences of not opening this are Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c Sat Dec 28 23:40:32 2019 (r356163) @@ -1787,7 +1787,7 @@ read_PackInfo(struct archive_read *a, struct _7z_pack_ return (0); } - if (*p != kSize) + if (*p != kCRC) return (-1); if (read_Digests(a, &(pi->digest), (size_t)pi->numPackStreams) < 0) Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c Sat Dec 28 23:40:32 2019 (r356163) @@ -175,7 +175,9 @@ struct lha { struct archive_string gname; uint16_t header_crc; uint16_t crc; - struct archive_string_conv *sconv; + /* dirname and filename could be in different codepages */ + struct archive_string_conv *sconv_dir; + struct archive_string_conv *sconv_fname; struct archive_string_conv *opt_sconv; struct archive_string dirname; @@ -232,8 +234,8 @@ static time_t lha_dos_time(const unsigned char *); static time_t lha_win_time(uint64_t, long *); static unsigned char lha_calcsum(unsigned char, const void *, int, size_t); -static int lha_parse_linkname(struct archive_string *, - struct archive_string *); +static int lha_parse_linkname(struct archive_wstring *, + struct archive_wstring *); static int lha_read_data_none(struct archive_read *, const void **, size_t *, int64_t *); static int lha_read_data_lzh(struct archive_read *, const void **, @@ -473,13 +475,15 @@ static int archive_read_format_lha_read_header(struct archive_read *a, struct archive_entry *entry) { - struct archive_string linkname; - struct archive_string pathname; + struct archive_wstring linkname; + struct archive_wstring pathname; struct lha *lha; const unsigned char *p; const char *signature; int err; - + struct archive_mstring conv_buffer; + const wchar_t *conv_buffer_p; + lha_crc16_init(); a->archive.archive_format = ARCHIVE_FORMAT_LHA; @@ -561,10 +565,13 @@ archive_read_format_lha_read_header(struct archive_rea archive_string_empty(&lha->dirname); archive_string_empty(&lha->filename); lha->dos_attr = 0; - if (lha->opt_sconv != NULL) - lha->sconv = lha->opt_sconv; - else - lha->sconv = NULL; + if (lha->opt_sconv != NULL) { + lha->sconv_dir = lha->opt_sconv; + lha->sconv_fname = lha->opt_sconv; + } else { + lha->sconv_dir = NULL; + lha->sconv_fname = NULL; + } switch (p[H_LEVEL_OFFSET]) { case 0: @@ -594,13 +601,55 @@ archive_read_format_lha_read_header(struct archive_rea return (truncated_error(a)); /* - * Make a pathname from a dirname and a filename. - */ - archive_string_concat(&lha->dirname, &lha->filename); + * Make a pathname from a dirname and a filename, after converting to Unicode. + * This is because codepages might differ between dirname and filename. + */ archive_string_init(&pathname); archive_string_init(&linkname); - archive_string_copy(&pathname, &lha->dirname); + archive_string_init(&conv_buffer.aes_mbs); + archive_string_init(&conv_buffer.aes_mbs_in_locale); + archive_string_init(&conv_buffer.aes_utf8); + archive_string_init(&conv_buffer.aes_wcs); + if (0 != archive_mstring_copy_mbs_len_l(&conv_buffer, lha->dirname.s, lha->dirname.length, lha->sconv_dir)) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Pathname cannot be converted " + "from %s to Unicode.", + archive_string_conversion_charset_name(lha->sconv_dir)); + err = ARCHIVE_FATAL; + } else if (0 != archive_mstring_get_wcs(&a->archive, &conv_buffer, &conv_buffer_p)) + err = ARCHIVE_FATAL; + if (err == ARCHIVE_FATAL) { + archive_mstring_clean(&conv_buffer); + archive_wstring_free(&pathname); + archive_wstring_free(&linkname); + return (err); + } + archive_wstring_copy(&pathname, &conv_buffer.aes_wcs); + archive_string_empty(&conv_buffer.aes_mbs); + archive_string_empty(&conv_buffer.aes_mbs_in_locale); + archive_string_empty(&conv_buffer.aes_utf8); + archive_wstring_empty(&conv_buffer.aes_wcs); + if (0 != archive_mstring_copy_mbs_len_l(&conv_buffer, lha->filename.s, lha->filename.length, lha->sconv_fname)) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Pathname cannot be converted " + "from %s to Unicode.", + archive_string_conversion_charset_name(lha->sconv_fname)); + err = ARCHIVE_FATAL; + } + else if (0 != archive_mstring_get_wcs(&a->archive, &conv_buffer, &conv_buffer_p)) + err = ARCHIVE_FATAL; + if (err == ARCHIVE_FATAL) { + archive_mstring_clean(&conv_buffer); + archive_wstring_free(&pathname); + archive_wstring_free(&linkname); + return (err); + } + archive_wstring_concat(&pathname, &conv_buffer.aes_wcs); + archive_mstring_clean(&conv_buffer); + if ((lha->mode & AE_IFMT) == AE_IFLNK) { /* * Extract the symlink-name if it's included in the pathname. @@ -610,8 +659,8 @@ archive_read_format_lha_read_header(struct archive_rea archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Unknown symlink-name"); - archive_string_free(&pathname); - archive_string_free(&linkname); + archive_wstring_free(&pathname); + archive_wstring_free(&linkname); return (ARCHIVE_FAILED); } } else { @@ -629,39 +678,13 @@ archive_read_format_lha_read_header(struct archive_rea /* * Set basic file parameters. */ - if (archive_entry_copy_pathname_l(entry, pathname.s, - pathname.length, lha->sconv) != 0) { - if (errno == ENOMEM) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate memory for Pathname"); - return (ARCHIVE_FATAL); - } - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Pathname cannot be converted " - "from %s to current locale.", - archive_string_conversion_charset_name(lha->sconv)); - err = ARCHIVE_WARN; - } - archive_string_free(&pathname); + archive_entry_copy_pathname_w(entry, pathname.s); + archive_wstring_free(&pathname); if (archive_strlen(&linkname) > 0) { - if (archive_entry_copy_symlink_l(entry, linkname.s, - linkname.length, lha->sconv) != 0) { - if (errno == ENOMEM) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate memory for Linkname"); - return (ARCHIVE_FATAL); - } - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Linkname cannot be converted " - "from %s to current locale.", - archive_string_conversion_charset_name(lha->sconv)); - err = ARCHIVE_WARN; - } + archive_entry_copy_symlink_w(entry, linkname.s); } else archive_entry_set_symlink(entry, NULL); - archive_string_free(&linkname); + archive_wstring_free(&linkname); /* * When a header level is 0, there is a possibility that * a pathname and a symlink has '\' character, a directory @@ -1208,6 +1231,26 @@ lha_read_file_extended_header(struct archive_read *a, archive_strncpy(&lha->filename, (const char *)extdheader, datasize); break; + case EXT_UTF16_FILENAME: + if (datasize == 0) { + /* maybe directory header */ + archive_string_empty(&lha->filename); + break; + } else if (datasize & 1) { + /* UTF-16 characters take always 2 or 4 bytes */ + goto invalid; + } + if (extdheader[0] == '\0') + goto invalid; + archive_string_empty(&lha->filename); + archive_array_append(&lha->filename, + (const char *)extdheader, datasize); + /* Setup a string conversion for a filename. */ + lha->sconv_fname = archive_string_conversion_from_charset( + &a->archive, "UTF-16LE", 1); + if (lha->sconv_fname == NULL) + return (ARCHIVE_FATAL); + break; case EXT_DIRECTORY: if (datasize == 0 || extdheader[0] == '\0') /* no directory name data. exit this case. */ @@ -1228,6 +1271,36 @@ lha_read_file_extended_header(struct archive_read *a, /* invalid directory data */ goto invalid; break; + case EXT_UTF16_DIRECTORY: + /* UTF-16 characters take always 2 or 4 bytes */ + if (datasize == 0 || (datasize & 1) || extdheader[0] == '\0') + /* no directory name data. exit this case. */ + goto invalid; + + archive_string_empty(&lha->dirname); + archive_array_append(&lha->dirname, + (const char *)extdheader, datasize); + lha->sconv_dir = archive_string_conversion_from_charset( + &a->archive, "UTF-16LE", 1); + if (lha->sconv_dir == NULL) + return (ARCHIVE_FATAL); + else { + /* + * Convert directory delimiter from 0xFF + * to '/' for local system. + */ + /* UTF-16LE character */ + uint16_t *utf16name = (uint16_t *)lha->dirname.s; + for (i = 0; i < lha->dirname.length / 2; i++) { + if (utf16name[i] == 0xFFFF) + utf16name[i] = L'/'; + } + /* Is last character directory separator? */ + if (utf16name[lha->dirname.length / 2 - 1] != L'/') + /* invalid directory data */ + goto invalid; + } + break; case EXT_DOS_ATTR: if (datasize == 2) lha->dos_attr = (unsigned char) @@ -1276,12 +1349,17 @@ lha_read_file_extended_header(struct archive_read *a, charset = cp.s; break; } - lha->sconv = + lha->sconv_dir = archive_string_conversion_from_charset( &(a->archive), charset, 1); + lha->sconv_fname = + archive_string_conversion_from_charset( + &(a->archive), charset, 1); archive_string_free(&cp); - if (lha->sconv == NULL) + if (lha->sconv_dir == NULL) return (ARCHIVE_FATAL); + if (lha->sconv_fname == NULL) + return (ARCHIVE_FATAL); } break; case EXT_UNIX_MODE: @@ -1336,8 +1414,7 @@ lha_read_file_extended_header(struct archive_read *a, } break; case EXT_TIMEZONE: /* Not supported */ - case EXT_UTF16_FILENAME: /* Not supported */ - case EXT_UTF16_DIRECTORY: /* Not supported */ + break; default: break; } @@ -1600,19 +1677,19 @@ archive_read_format_lha_cleanup(struct archive_read *a * then a archived pathname is 'xxx/bbb|aaa/bb/cc' */ static int -lha_parse_linkname(struct archive_string *linkname, - struct archive_string *pathname) +lha_parse_linkname(struct archive_wstring *linkname, + struct archive_wstring *pathname) { - char * linkptr; + wchar_t * linkptr; size_t symlen; - linkptr = strchr(pathname->s, '|'); + linkptr = wcschr(pathname->s, L'|'); if (linkptr != NULL) { - symlen = strlen(linkptr + 1); - archive_strncpy(linkname, linkptr+1, symlen); + symlen = wcslen(linkptr + 1); + archive_wstrncpy(linkname, linkptr+1, symlen); *linkptr = 0; - pathname->length = strlen(pathname->s); + pathname->length = wcslen(pathname->s); return (1); } Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_rar5.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_rar5.c Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_rar5.c Sat Dec 28 23:40:32 2019 (r356163) @@ -63,6 +63,7 @@ #if defined DEBUG #define DEBUG_CODE if(1) +#define LOG(...) do { printf("rar5: " __VA_ARGS__); puts(""); } while(0) #else #define DEBUG_CODE if(0) #endif @@ -115,6 +116,8 @@ struct file_header { /* Optional redir fields */ uint64_t redir_type; uint64_t redir_flags; + + ssize_t solid_window_size; /* Used in file format check. */ }; enum EXTRA { @@ -1177,7 +1180,7 @@ static int process_main_locator_extra_block(struct arc static int parse_file_extra_hash(struct archive_read* a, struct rar5* rar, ssize_t* extra_data_size) { - size_t hash_type; + size_t hash_type = 0; size_t value_len; if(!read_var_sized(a, &hash_type, &value_len)) @@ -1303,7 +1306,7 @@ static int parse_file_extra_htime(struct archive_read* struct archive_entry* e, struct rar5* rar, ssize_t* extra_data_size) { char unix_time = 0; - size_t flags; + size_t flags = 0; size_t value_len; enum HTIME_FLAGS { @@ -1665,7 +1668,18 @@ static int process_head_file(struct archive_read* a, s g_unpack_window_size << ((compression_info >> 10) & 15); rar->cstate.method = c_method; rar->cstate.version = c_version + 50; + rar->file.solid = (compression_info & SOLID) > 0; + /* Archives which declare solid files without initializing the window + * buffer first are invalid. */ + + if(rar->file.solid > 0 && rar->cstate.window_buf == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Declared solid file, but no window buffer " + "initialized yet."); + return ARCHIVE_FATAL; + } + /* Check if window_size is a sane value. Also, if the file is not * declared as a directory, disallow window_size == 0. */ if(window_size > (64 * 1024 * 1024) || @@ -1676,12 +1690,36 @@ static int process_head_file(struct archive_read* a, s return ARCHIVE_FATAL; } - /* Values up to 64M should fit into ssize_t on every - * architecture. */ - rar->cstate.window_size = (ssize_t) window_size; + if(rar->file.solid > 0) { + /* Re-check if current window size is the same as previous + * window size (for solid files only). */ + if(rar->file.solid_window_size > 0 && + rar->file.solid_window_size != (ssize_t) window_size) + { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Window size for this solid file doesn't match " + "the window size used in previous solid file. "); + return ARCHIVE_FATAL; + } + } + + /* If we're currently switching volumes, ignore the new definition of + * window_size. */ + if(rar->cstate.switch_multivolume == 0) { + /* Values up to 64M should fit into ssize_t on every + * architecture. */ + rar->cstate.window_size = (ssize_t) window_size; + } + + if(rar->file.solid > 0 && rar->file.solid_window_size == 0) { + /* Solid files have to have the same window_size across + whole archive. Remember the window_size parameter + for first solid file found. */ + rar->file.solid_window_size = rar->cstate.window_size; + } + init_window_mask(rar); - rar->file.solid = (compression_info & SOLID) > 0; rar->file.service = 0; if(!read_var_sized(a, &host_os, NULL)) Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c Sat Dec 28 23:40:32 2019 (r356163) @@ -1797,6 +1797,23 @@ zip_read_data_zipx_lzma_alone(struct archive_read *a, "lzma data error (error %d)", (int) lz_ret); return (ARCHIVE_FATAL); + /* This case is optional in lzma alone format. It can happen, + * but most of the files don't have it. (GitHub #1257) */ + case LZMA_STREAM_END: + lzma_end(&zip->zipx_lzma_stream); + zip->zipx_lzma_valid = 0; + if((int64_t) zip->zipx_lzma_stream.total_in != + zip->entry_bytes_remaining) + { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "lzma alone premature end of stream"); + return (ARCHIVE_FATAL); + } + + zip->end_of_entry = 1; + break; + case LZMA_OK: break; Modified: vendor/libarchive/dist/libarchive/archive_string.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_string.c Sat Dec 28 23:21:53 2019 (r356162) +++ vendor/libarchive/dist/libarchive/archive_string.c Sat Dec 28 23:40:32 2019 (r356163) @@ -75,6 +75,9 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_string #define wmemmove(a,b,i) (wchar_t *)memmove((a), (b), (i) * sizeof(wchar_t)) #endif +#undef max +#define max(a, b) ((a)>(b)?(a):(b)) + struct archive_string_conv { struct archive_string_conv *next; char *from_charset; @@ -591,7 +594,7 @@ archive_wstring_append_from_mbs(struct archive_wstring * No single byte will be more than one wide character, * so this length estimate will always be big enough. */ - size_t wcs_length = len; + // size_t wcs_length = len; size_t mbs_length = len; const char *mbs = p; wchar_t *wcs; @@ -600,7 +603,11 @@ archive_wstring_append_from_mbs(struct archive_wstring memset(&shift_state, 0, sizeof(shift_state)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912282340.xBSNeWfu025439>