Aaron Lindros [Sat, 9 Dec 2023 01:50:03 +0000 (20:50 -0500)]
Fix encoding detection on platforms with nl_langinfo() (#2030)
libarchive relies on its host program to call setlocale() on platforms
with nl_langinfo() present in order to correctly detect the user
selected locale. This ensures that bsdunzip does so.
Emil Velikov [Fri, 8 Dec 2023 03:22:27 +0000 (03:22 +0000)]
Minor __LA_NORETURN inspired fixes (#2028)
Earlier MR https://github.com/libarchive/libarchive/pull/2000 forgot to
annotate some functions as __LA_NORETURN. While fixing that I've noticed
that the bsdcat.h header could use some fixes so I've snuck those in.
Kind of make sense to group in one PR, but can split people prefer so.
/cc @AtariDreams fyi
---------
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Results from running the following command, before and after this
change, formatted for easy comparison (the actual values will vary with
toolchain and library versions used):
```
size bsdtar bsdcpio bsdunzip bsdcat .libs/libarchive.13.dylib
YAMASHINA Hio [Mon, 4 Dec 2023 16:24:51 +0000 (01:24 +0900)]
xz: fix incorrect eof at the end of an lzip member. (#2027)
xz filter returns incorrect eof if the end of an lzip member is at the
end of the read buffer (`state->stream.next_in`).
At next call of `xz_filter_read()`, following lzip members are never
read since `state->eof` is still flagged.
Fixes #2026.
Dustin L. Howett [Tue, 21 Nov 2023 20:26:46 +0000 (14:26 -0600)]
Add a new Windows-only public API, archive_read_open_filenames_w (#2016)
There is a discrepancy between the w and non-w filename APIs, wherein a
consumer of libarchive can open a multi-volume set with names in the
current locale (on Windows) but not with UTF-16 names.
This patch addresses that issue.
archive_read_open_filename_w delegates its work to
archive_read_open_filenames_w.
Fixes #1728
Tested passing on Windows. In the meantime, I will also test on Linux.
I am hoping that the build agents can help me determine FreeBSD and
macOS coverage.
Brooks Davis [Tue, 21 Nov 2023 01:41:49 +0000 (17:41 -0800)]
VCSid removal (#2017)
The libarchive source tree is littered with `__FBSDID("$FreeBSD.*")` and
'$FreeBSD$' tags left over from extracting it from FreeBSD's Subversion
repo. They never made sense for a git repo as git doesn't expand them
and FreeBSD has now removed `$FreeBSD$` from most local source files so
these stand out.
In addition to `__FBSDID` I've removed `__RCSID` which was used once for
a `$NetBSD$` expansion. There might be more of a case to be made for
preserving this one as a diff-reduction measure, but it seems mostly
pointless.
This builds and tests pass except for
libarchive_test_read_disk_directory_traversals which failed on master as
well.
alice [Fri, 22 Sep 2023 23:57:55 +0000 (01:57 +0200)]
fix detection of lzma_stream_encoder_mt with Werror (#1965)
the function is marked as warn-unused-result, so by default in a Debug
build with cmake, when Werror is set, this fails to detect. do the same
for autotools.
Roland Clobus [Sat, 16 Sep 2023 17:53:54 +0000 (19:53 +0200)]
Preserve the natural order in ISO9660 archives for linked files (#1974)
When an ISO9660 archive contains hard links or sym links, the order of
the files in the output of 'bsdtar -tf filename' is not the natural
order.
With an extension to the key (while still supporting ISO files up to 2^48
bytes) the sorting order is guaranteed for ISO files that contain linked
files for up to 2^16 files in total.
Co-authored-by: Martin Matuska <martin@matuska.de>
Pedro Nacht [Mon, 11 Sep 2023 20:02:18 +0000 (17:02 -0300)]
Hash-pin GitHub Actions, keep them updated with dependabot (#1960)
Fixes #1959.
This PR hash-pins GitHub Actions used in workflows and sets up
dependabot to keep the Actions up-to-date.
I've configured dependabot to group all Actions together. So if it ever
discovers that multiple Actions have new versions, it'll only send a
single PR to bump them all together.
---------
Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
Pedro Nacht [Mon, 4 Sep 2023 18:21:27 +0000 (15:21 -0300)]
Set read-only workflow tokens (#1958)
Fixes #1957.
This PR ensures all workflows run with minimal permissions, instead of
with `write-all` permissions. This will protect the project from
supply-chain attacks.
The change to codeql.yml is for consistency and future-proofing. Should
another job eventually be added to the workflow, it will run with just
`contents: read`.
Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
7zip reader: translate windows permissions to unix permissions (#1943)
7z archives created on windows 7zip can lack unix permission info. In
this case, we need to translate the windows permissions into reasonable
unix equivalents.
Martin Matuska [Thu, 17 Aug 2023 22:28:39 +0000 (00:28 +0200)]
pax writer: fix multiple security vulnerabilities
Security vulnerabilities:
1. Heap overflow in url_encode() in archive_write_set_format_pax.c
2. NULL dereference in archive_write_pax_header_xattrs()
3. Another NULL dereference in archive_write_pax_header_xattrs()
4. NULL dereference in archive_write_pax_header_xattr()
The vulnerabilities can be triggered when writing pax archives
with extended attributes (SCHILY or LIBARCHIVE) by feeding attribute
names longer than INT_MAX or attribute names that fail to be encoded
properly.
Michał Górny [Wed, 19 Jul 2023 08:22:25 +0000 (10:22 +0200)]
Makefile: add mkdirs for all */test/list.h targets (#1923)
Add missing mkdir calls to `cat/test/list.h` and `unzip/test/list.h`
invocations, making them consistent with the other rules. Otherwise,
the build fails when configured with `--disable-dependency-tracking`,
as configure does not create the directories automatically then.
7-Zip 23.00 added a new ARM64 filter, which is also supported by recent
versions of liblzma. This PR adds support for this filter for both lzma
and non-lzma encoders.
Peter Kaestle [Mon, 3 Apr 2023 11:35:35 +0000 (13:35 +0200)]
README: vulnerability on implicite directory creation
There's a race condition with the umask() execution in multi-threaded
use of the libarchive.
It's the users responsibility to mutex archive_write_disk_header()
call.
Signed-off-by: Peter Kaestle <peter.kaestle@nokia.com>