]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
10 days agoMerge pull request #2993 from kientzle/kientzle-zip-long-pathnames
Tim Kientzle [Sun, 3 May 2026 16:36:26 +0000 (09:36 -0700)] 
Merge pull request #2993 from kientzle/kientzle-zip-long-pathnames

[Zip] Don't try to write overlong pathnames

10 days ago[Zip] Reject empty pathnames in ZIP writer
Tim Kientzle [Sun, 3 May 2026 16:32:00 +0000 (09:32 -0700)] 
[Zip] Reject empty pathnames in ZIP writer

An empty pathname caused a one-byte OOB read before the heap buffer in
write_path() due to two compounding bugs:
(1) misuse of bitwise & instead of logical &&, and
(2) missing gaurd for an empty pathname

10 days ago[Zip] Reject overlong pathnames in Zip writer 2993/head
Tim Kientzle [Sat, 2 May 2026 23:52:35 +0000 (16:52 -0700)] 
[Zip] Reject overlong pathnames in Zip writer

10 days agoTest writing overlong Zip pathnames
Tim Kientzle [Sat, 2 May 2026 23:52:19 +0000 (16:52 -0700)] 
Test writing overlong Zip pathnames

10 days ago[ACL] Add more tests for POSIX.1e ACLs 2992/head
Tim Kientzle [Sat, 2 May 2026 23:23:32 +0000 (16:23 -0700)] 
[ACL] Add more tests for POSIX.1e ACLs

This mirrors the tests just added for NFS4 ACLs.  They
didn't uncover any problems.

10 days ago[archive_acl] Reject ACL entries with out-of-range numeric IDs
Tim Kientzle [Sat, 2 May 2026 18:51:47 +0000 (11:51 -0700)] 
[archive_acl] Reject ACL entries with out-of-range numeric IDs

isint() and isint_w() previously clamped values >= INT_MAX to INT_MAX
and returned success, allowing malformed ACL text to silently set IDs
to an arbitrary sentinel value.  Change them to return -1 (a new
"overflow" indication) instead, and update all callers in both the
NFS4 and POSIX parsers (narrow and wide) to treat overflow as
ARCHIVE_WARN and skip the offending entry.

Add test_acl_nfs4_text.c with four test functions covering NFS4 ACL
text round-trips, audit/alarm entry types, numeric-ID handling
including the overflow boundary (INT_MAX - 1 accepted, INT_MAX
rejected), and malformed-entry error paths.

10 days ago[tar] Harden timestamp parsing
Tim Kientzle [Sat, 2 May 2026 20:58:45 +0000 (13:58 -0700)] 
[tar] Harden timestamp parsing

Improves the parsing of timestamps in a couple of ways:

* Saturate when timestamps exceed the range of time_t.
  In particular, this provides more rational behavior on
  systems with 32-bit time_t.

* Validate the format of overlong pax timestamps.
  We previously failed to check that high-resolution
  timestamps had only digits in the fractional part.
  We now notice and ignore those with a warning.

11 days agoMerge pull request #2990 from kientzle/kientzle-gitignore-AI-files
Tim Kientzle [Sat, 2 May 2026 19:05:07 +0000 (15:05 -0400)] 
Merge pull request #2990 from kientzle/kientzle-gitignore-AI-files

Ignore local CLAUDE/GEMINI files

11 days agoIgnore local CLAUDE/GEMINI files 2990/head
Tim Kientzle [Sat, 2 May 2026 19:03:57 +0000 (12:03 -0700)] 
Ignore local CLAUDE/GEMINI files

11 days agoMerge pull request #2989 from kientzle/kientzle-test-documentation
Tim Kientzle [Sat, 2 May 2026 19:02:14 +0000 (15:02 -0400)] 
Merge pull request #2989 from kientzle/kientzle-test-documentation

Minor clarification on test discovery

11 days agoMinor clarification on test discovery 2989/head
Tim Kientzle [Sat, 2 May 2026 19:00:33 +0000 (12:00 -0700)] 
Minor clarification on test discovery

11 days agoMerge pull request #2985 from stoeckmann/7zip_sfx
Martin Matuška [Sat, 2 May 2026 18:48:01 +0000 (20:48 +0200)] 
Merge pull request #2985 from stoeckmann/7zip_sfx

7zip: Harden SFX parser

11 days agoMerge pull request #2988 from kientzle/kientzle-acl-to-text
Martin Matuška [Sat, 2 May 2026 18:43:56 +0000 (20:43 +0200)] 
Merge pull request #2988 from kientzle/kientzle-acl-to-text

[archive_acl] Fix buffer overrun and wrong output for NULL-name ACL entries

11 days agoarchive_acl: Fix buffer overrun and wrong output for NULL-name ACL entries 2988/head
Tim Kientzle [Sat, 2 May 2026 16:46:06 +0000 (09:46 -0700)] 
archive_acl: Fix buffer overrun and wrong output for NULL-name ACL entries

archive_acl_text_len() counted the trailing ":id" digits only when
ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID was set, but archive_acl_to_text_l()
always writes them for USER/GROUP entries whose name is NULL.  With a
7-digit or larger id the allocated buffer was too short, causing
append_id() to write past its end.

Fix the estimator to also count the extra colon and digits when the
name is NULL, matching the serializer's logic.

The wide serializer (archive_acl_to_text_w) had the opposite problem:
it passed id=-1 to append_entry_w() for NULL-name entries regardless
of the id value, causing a garbage character to be written in the name
field and the numeric id to be omitted entirely.  Fix it to mirror the
narrow serializer by setting id = ap->id when wname is NULL.

Add tests for both the narrow and wide paths.

11 days agoMerge pull request #2983 from kientzle/kientzle-iso9660-joliet-pathname
Tim Kientzle [Sat, 2 May 2026 16:09:47 +0000 (12:09 -0400)] 
Merge pull request #2983 from kientzle/kientzle-iso9660-joliet-pathname

[iso9660] Fix joliet pathname overflow

11 days agoMerge pull request #2973 from dag-erling/des/darwin-crypto
Tim Kientzle [Sat, 2 May 2026 16:07:28 +0000 (12:07 -0400)] 
Merge pull request #2973 from dag-erling/des/darwin-crypto

On Darwin, get digests from libsystem

11 days agoconfigure: On Darwin, get digests from libsystem 2973/head
Dag-Erling Smørgrav [Mon, 20 Apr 2026 18:31:28 +0000 (20:31 +0200)] 
configure: On Darwin, get digests from libsystem

Darwin covers a wide range of platforms with similar but not identical
sets of libraries.  MD5, SHA1 and SHA2 are available from libsystem on
all of these, but macOS also has them in libc and libmd.  Restricting
our search to only libsystem means we can run configure on macOS and get
a config.h that also works for other Darwin platforms.

2 weeks ago7zip: Fix typos in comment 2985/head
Tobias Stoeckmann [Mon, 27 Apr 2026 18:15:44 +0000 (20:15 +0200)] 
7zip: Fix typos in comment

Also clarify that all systems will handle these SFX files, no matter on
which system libarchive is used.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 weeks ago7zip: Cap maximum allocation for SFX handling
Tobias Stoeckmann [Mon, 27 Apr 2026 17:58:05 +0000 (19:58 +0200)] 
7zip: Cap maximum allocation for SFX handling

If 7zip header cannot be found within roughly first 8 MB of data, skip
detection and assume that file is not a valid 7zip archive.

This avoids various 32 bit truncation issues as well as out of memory
conditions.

Reported by various individuals:
- Amemoyoi
- b4sh5i
- Jie Zhu
- Tikket
- wooseokdotkim

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 weeks ago7zip: Be precise about SFX data types
Tobias Stoeckmann [Mon, 27 Apr 2026 17:45:10 +0000 (19:45 +0200)] 
7zip: Be precise about SFX data types

Use desired data types: Offsets in files are (u)int64_t, sizes in memory
are (s)size_t. Use signedness when needed or specified by APIs.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 weeks ago7zip: Adjust sfx offset function signatures
Tobias Stoeckmann [Mon, 27 Apr 2026 17:24:15 +0000 (19:24 +0200)] 
7zip: Adjust sfx offset function signatures

Return an int for error information and supply offset through a given
argument. This fits other function declarations and makes it much easier
to differentiate between status and "return value".

While at it, merge fallback mechanism of both functions.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 weeks ago7zip: Merge skip_sfx into get_data_offset
Tobias Stoeckmann [Mon, 27 Apr 2026 17:13:17 +0000 (19:13 +0200)] 
7zip: Merge skip_sfx into get_data_offset

This removes the function skip_sfx which makes slurp_central_directory
and archive_read_format_7zip_bid use the same code now.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 weeks ago7zip: Introduce get_data_offset
Tobias Stoeckmann [Mon, 27 Apr 2026 17:05:39 +0000 (19:05 +0200)] 
7zip: Introduce get_data_offset

Its functionality is split off from archive_read_format_7zip_bid
and returns offset to actual data, i.e. it handles self extracting
(SFX) files if offset 0 is not already a 7zip magic.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 weeks ago7zip: Reduce archive_read_format_7zip_bid depth
Tobias Stoeckmann [Mon, 27 Apr 2026 16:55:13 +0000 (18:55 +0200)] 
7zip: Reduce archive_read_format_7zip_bid depth

Prepare content of archive_read_format_7zip_bid to be split into its own
function which eventually can be reused by slurp_central_directory.

No real functional change (split if-blocks).

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 weeks ago7zip: Remove casts in check_7zip_header_in_sfx
Tobias Stoeckmann [Mon, 27 Apr 2026 16:40:37 +0000 (18:40 +0200)] 
7zip: Remove casts in check_7zip_header_in_sfx

Directly request an unsigned char pointer. This removes casts within the
function check_7zip_header_in_sfx and its surrounding caller code.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 weeks agoFix joliet pathname buffer overflow 2983/head
Tim Kientzle [Sun, 26 Apr 2026 22:22:10 +0000 (18:22 -0400)] 
Fix joliet pathname buffer overflow

2 weeks ago[ISO9660] Test for buffer overflows with Joliet pathname building
Tim Kientzle [Sun, 26 Apr 2026 22:20:57 +0000 (18:20 -0400)] 
[ISO9660] Test for buffer overflows with Joliet pathname building

Credit: Anthropic

2 weeks agoMerge pull request #2526 from fdegros/compress_support
Tim Kientzle [Sat, 25 Apr 2026 20:51:46 +0000 (16:51 -0400)] 
Merge pull request #2526 from fdegros/compress_support

Fix SIGSEGV in compress filter when appended before open

2 weeks agoMerge pull request #2980 from kientzle/kientzle-7zip-numfiles
Tim Kientzle [Sat, 25 Apr 2026 20:42:06 +0000 (16:42 -0400)] 
Merge pull request #2980 from kientzle/kientzle-7zip-numfiles

[7zip] Sanity-check the number of files

2 weeks ago[7zip] Sanity-check the number of files 2980/head
Tim Kientzle [Sat, 25 Apr 2026 18:58:17 +0000 (14:58 -0400)] 
[7zip] Sanity-check the number of files

We allocate space early on to support the advertised number of
files. A malicious archive can set a nonsensical value here to exhaust
memory. This adds a check comparing the number of files to the number
of streams and the size of the total header.

Note that the just-added test does not actually fail without this.
The existing code recovers if the allocation fails, which it typically
will.  The new check tightens the limit so that we reject nonsensical
file counts and avoid problems from large memory allocations.

2 weeks agoMerge pull request #2981 from kientzle/kientzle-zip-lzma-memory
Tim Kientzle [Sat, 25 Apr 2026 18:57:19 +0000 (14:57 -0400)] 
Merge pull request #2981 from kientzle/kientzle-zip-lzma-memory

[Zip] Limit the LZMA initialization to 64MiB memory

2 weeks agoMerge pull request #2964 from kientzle/kientzle-test-documentation
Tim Kientzle [Sat, 25 Apr 2026 18:51:42 +0000 (14:51 -0400)] 
Merge pull request #2964 from kientzle/kientzle-test-documentation

Document how to write new tests and how to build and run test suites

2 weeks ago[7zip] Test extracting an archive with a malicious file count
Tim Kientzle [Sat, 25 Apr 2026 18:48:34 +0000 (14:48 -0400)] 
[7zip] Test extracting an archive with a malicious file count

This currently results in an oversized allocation that can
exhaust available memory.

2 weeks agoLimit LZMA memory allocation to 576MiB 2981/head
Tim Kientzle [Sat, 25 Apr 2026 18:39:28 +0000 (14:39 -0400)] 
Limit LZMA memory allocation to 576MiB

Reject Zip entries that declare an LZMA dictionary size
greater than the maximum possible with Level 9 compression.

2 weeks agoTest extracting Zip Lzma entry with a malicious dictionary size
Tim Kientzle [Sat, 25 Apr 2026 18:32:32 +0000 (14:32 -0400)] 
Test extracting Zip Lzma entry with a malicious dictionary size

2 weeks agoAdditional adjustments 2964/head
Tim Kientzle [Sat, 25 Apr 2026 01:50:42 +0000 (21:50 -0400)] 
Additional adjustments

2 weeks agoMerge pull request #2979 from tyler-yankee/cab-huffman-memcheck
Tim Kientzle [Fri, 24 Apr 2026 23:44:26 +0000 (19:44 -0400)] 
Merge pull request #2979 from tyler-yankee/cab-huffman-memcheck

cab reader: Fix use of uninitialized values from Huffman table

2 weeks agoAdd tests for appending various filters before archive open 2526/head
François Degros [Fri, 24 Apr 2026 07:34:10 +0000 (17:34 +1000)] 
Add tests for appending various filters before archive open

Extend test coverage to ensure all supported filters can be appended
to an archive reader before it is opened, matching the behavior
required to fix #2514.

Added tests for: BZIP2, LRZIP, LZ4, LZIP, LZMA, ZSTD, RPM, UU, and NONE.

2 weeks agoFix SIGSEGV in compress filter when appended before open
François Degros [Fri, 24 Apr 2026 07:09:13 +0000 (17:09 +1000)] 
Fix SIGSEGV in compress filter when appended before open

Calling archive_read_append_filter(a, ARCHIVE_FILTER_COMPRESS) would
previously trigger a crash because compress_bidder_init() attempted to
read header bits from the upstream filter immediately. If the archive
was not yet opened (common when setting up filters), the upstream filter
state was not ready for reading.

This commit defers the header reading and decompressor initialization
until the first read operation (lazy initialization), consistent with
other filter implementations in libarchive.

Added test_read_append_compress_filter.

Bug: https://github.com/libarchive/libarchive/issues/2514
Test: ./libarchive_test test_read_append_compress_filter

2 weeks agocab reader: Fix use of uninitialized values from Huffman table 2979/head
Tyler Yankee [Thu, 23 Apr 2026 12:02:52 +0000 (08:02 -0400)] 
cab reader: Fix use of uninitialized values from Huffman table

Initialize the Huffman table to invalid values, which doesn't otherwise
affect the computation but avoids use of uninitialized values upon
extraction of some archives (as reported by `valgrind`).

3 weeks agoMerge pull request #2966 from solbjorn/win-crypt-unforce
Tim Kientzle [Wed, 22 Apr 2026 01:09:17 +0000 (18:09 -0700)] 
Merge pull request #2966 from solbjorn/win-crypt-unforce

libarchive: fix Windows compilation with `ENABLE_CNG=OFF`

3 weeks agolibarchive: fix Windows compilation with ENABLE_CNG=OFF 2966/head
Alexander Lobakin [Tue, 21 Apr 2026 20:50:18 +0000 (22:50 +0200)] 
libarchive: fix Windows compilation with ENABLE_CNG=OFF

Currently, libarchive_{random,util}.c use a couple bcrypt functions
regardless of whether HAVE_BCRYPT_H is defined as there are no other
implementations for Windows, but the actual <bcrypt.h> header is
included only under this macro.

To be able to build libarchive with ENABLE_CNG=OFF (for example, to
prefer a different crypto/digest engine) on Windows, don't guard
the include in these two files. In that case, bcrypt will still be
used, but only as an RNG.
This won't break anything because, as mentioned above, bcrypt is
used unconditionally here and if it's not present in the system,
the library won't build either way, with or without the change.
At least until we implement an RNG for Windows based on something
else.

Signed-off-by: Alexander Lobakin <alobakin@mailbox.org>
3 weeks agoMerge pull request #2971 from stoeckmann/asan_memleak
Tim Kientzle [Tue, 21 Apr 2026 01:56:35 +0000 (18:56 -0700)] 
Merge pull request #2971 from stoeckmann/asan_memleak

Fix mem leaks found with ASAN-enabled test suites

3 weeks agoMerge pull request #2970 from stoeckmann/gitignore
Tim Kientzle [Tue, 21 Apr 2026 01:54:43 +0000 (18:54 -0700)] 
Merge pull request #2970 from stoeckmann/gitignore

build: Add more entries to .gitignore

3 weeks agoFix memory leaks in test suites 2971/head
Tobias Stoeckmann [Mon, 20 Apr 2026 17:09:05 +0000 (19:09 +0200)] 
Fix memory leaks in test suites

Release memory so ASAN becomes a viable option for test suites.

3 weeks agomtree: Always release digest memory
Tobias Stoeckmann [Mon, 20 Apr 2026 17:07:48 +0000 (19:07 +0200)] 
mtree: Always release digest memory

If a checksum has been provided through archive_entry and no data is
written, then digest internal memory is not released.

Fix this by always calling final functions, even if result is not
needed.

3 weeks agotar: Release memory on error path
Tobias Stoeckmann [Mon, 20 Apr 2026 17:06:11 +0000 (19:06 +0200)] 
tar: Release memory on error path

Release attr_name memory on error paths.

Fixes: 101646e34e88 ("tar: Keep block alignment after pax error")
Fixes: 36a530973a91 ("Fix an infinite loop when parsing `V` headers")
3 weeks agobuild: Add more entries to .gitignore 2970/head
Tobias Stoeckmann [Mon, 20 Apr 2026 16:05:19 +0000 (18:05 +0200)] 
build: Add more entries to .gitignore

Using cmake within VSCode leads to creation of files which are not covered
by .gitignore so far. Covers Linux and Windows builds.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoMerge pull request #2968 from stoeckmann/isofile_gen_utility_names_dotdot
Tim Kientzle [Sun, 19 Apr 2026 20:42:53 +0000 (13:42 -0700)] 
Merge pull request #2968 from stoeckmann/isofile_gen_utility_names_dotdot

iso9660: Fix `..` (dot dot) path normalization

3 weeks agoiso9660: Fix ../../ path normalization 2968/head
Tobias Stoeckmann [Sun, 19 Apr 2026 20:10:10 +0000 (22:10 +0200)] 
iso9660: Fix ../../ path normalization

The function isofile_gen_utility_names could resolve .. directory
entries in a way that dirname will start with "../". If this happens,
the while-loop is unable to detect this because it forwards until the
cursor detects a slash again.

Fix this by also taking "../" at the beginning into account. Such an
entry can happen if "../../" points before the top directory.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoiso9660: Add adjacent dot dot issue to test suite
Tobias Stoeckmann [Sun, 19 Apr 2026 20:08:23 +0000 (22:08 +0200)] 
iso9660: Add adjacent dot dot issue to test suite

If dot dot directory entries point before top directory, it can happen
that "../" will stay at the start of the path.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoiso9660: Handle multiple slashes after dot dot
Tobias Stoeckmann [Sun, 19 Apr 2026 20:02:29 +0000 (22:02 +0200)] 
iso9660: Handle multiple slashes after dot dot

The isofile_gen_utility_names function normalizes directories, including
dot dot directory entries. If such an entry has multiple slahes and leads
to the top directory, then the new path erroneously becomes absolute.

Skip multiple slashes.

If rp is not NULL, then it points to a slash already. Takes this into
account to unify the rp and dirname cases a bit more.

Resolves #2937.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoiso9660: Extend test suite for OOB access
Tobias Stoeckmann [Sun, 19 Apr 2026 20:00:00 +0000 (22:00 +0200)] 
iso9660: Extend test suite for OOB access

Normalizing dot dot directory entries with multiple slashes leads to
memory issues further down the call stack.

Reported in #2937.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoiso9660: Use memmove with overlapping memory
Tobias Stoeckmann [Sun, 19 Apr 2026 19:40:19 +0000 (21:40 +0200)] 
iso9660: Use memmove with overlapping memory

Resolving paths like "dir/../filename" to "filename" can lead
to a strcpy call with overlapping memory. Use memmove instead,
which already happens at times in isofile_gen_utility_names.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoMerge pull request #2965 from bgilbert/distcheck
Tim Kientzle [Sun, 19 Apr 2026 04:18:33 +0000 (21:18 -0700)] 
Merge pull request #2965 from bgilbert/distcheck

Have `make distcheck` verify CMake build succeeds

3 weeks agoHave `make distcheck` verify CMake build succeeds 2965/head
Benjamin Gilbert [Sun, 19 Apr 2026 04:05:06 +0000 (23:05 -0500)] 
Have `make distcheck` verify CMake build succeeds

There have been multiple instances of test cases being added to the CMake
build but not the Autotools one, thus omitting them from the released dist
tarball.  Prevent this by testing the CMake build during `make distcheck`.

3 weeks agoMerge pull request #2905 from Patsakas/Patsakas-fix-acl-bug
Tim Kientzle [Sun, 19 Apr 2026 04:04:59 +0000 (21:04 -0700)] 
Merge pull request #2905 from Patsakas/Patsakas-fix-acl-bug

Fix NULL pointer increment in archive_acl_from_text_nl

(Not a security issue, and arguably not really even a bug, but easy to fix regardless.)

3 weeks agoFix indentation in examples to match project style
Tim Kientzle [Sun, 19 Apr 2026 02:58:46 +0000 (19:58 -0700)] 
Fix indentation in examples to match project style

3 weeks agoDocument how to write new tests and how to build and run test suites
Tim Kientzle [Sun, 19 Apr 2026 02:51:27 +0000 (19:51 -0700)] 
Document how to write new tests and how to build and run test suites

I consider this an experiment to see if we can improve the
quality of incoming PRs.

3 weeks agoMerge pull request #2961 from bgilbert/malformed
Martin Matuška [Fri, 17 Apr 2026 23:33:00 +0000 (01:33 +0200)] 
Merge pull request #2961 from bgilbert/malformed

Add malformed CAB test to Autotools

3 weeks agoMerge pull request #2962 from dag-erling/des/optreset
Martin Matuška [Fri, 17 Apr 2026 23:27:42 +0000 (01:27 +0200)] 
Merge pull request #2962 from dag-erling/des/optreset

unzip: Remove dead code
test_main: Staticize some variables

3 weeks agotest_main: Staticize some variables 2962/head
Dag-Erling Smørgrav [Fri, 17 Apr 2026 16:43:59 +0000 (18:43 +0200)] 
test_main: Staticize some variables

These variables are not used outside test_main, so they should be static.

Fixes: a252c603080a ("test_main: Run tests as unprivileged user")

3 weeks agounzip: Remove dead code
Dag-Erling Smørgrav [Fri, 17 Apr 2026 13:34:13 +0000 (15:34 +0200)] 
unzip: Remove dead code

Remove an #include controlled by a preprocessor symbol that nothing
defines.  I'm not sure if this has ever been needed, or what for, but
it serves no purpose today.

3 weeks agoMerge pull request #2942 from benoit-pierre/pr/fix___LA_MODE_T_handling
Tim Kientzle [Fri, 17 Apr 2026 12:04:53 +0000 (05:04 -0700)] 
Merge pull request #2942 from benoit-pierre/pr/fix___LA_MODE_T_handling

fix `archive_entry_set_mode` & `archive_entry_set_perm`

3 weeks agofix `archive_entry_set_mode` & `archive_entry_set_perm` 2942/head
Benoit Pierre [Sat, 21 Mar 2026 11:36:09 +0000 (12:36 +0100)] 
fix `archive_entry_set_mode` & `archive_entry_set_perm`

Match the prototypes in `archive_entry.h`: use `__LA_MODE_T` (which is not always an alias for `mode_t`).

3 weeks agoAdd malformed CAB test to Autotools 2961/head
Benjamin Gilbert [Thu, 16 Apr 2026 15:36:03 +0000 (10:36 -0500)] 
Add malformed CAB test to Autotools

It wasn't being included in the dist tarball.

Fixes: 32b62cf785e6 ("Fix NULL pointer dereference in CAB parser during skip")
4 weeks agoMerge pull request #2957 from kientzle/kientzle-linkresolver
Tim Kientzle [Tue, 14 Apr 2026 03:14:58 +0000 (20:14 -0700)] 
Merge pull request #2957 from kientzle/kientzle-linkresolver

Fix a double-free in the link resolver

4 weeks agoRemove unused variable 2957/head
Tim Kientzle [Tue, 14 Apr 2026 03:00:24 +0000 (20:00 -0700)] 
Remove unused variable

4 weeks agoMinor code improvements
Tim Kientzle [Tue, 14 Apr 2026 02:58:12 +0000 (19:58 -0700)] 
Minor code improvements

4 weeks agoFix a double-free in the link resolver
Tim Kientzle [Tue, 14 Apr 2026 02:38:07 +0000 (19:38 -0700)] 
Fix a double-free in the link resolver

The link resolver is a helper utility that tracks linked
entries so they can be correctly restored.  Clients add link information
to the link resolver and incrementally query it to correctly
link entries as they are restored to disk.  The link resolver
incrementally releases entries as they are consumed in order
to minimize memory usage.

The `archive_entry_linkresolver_free()` method cleans up
by repeatedly querying the cache and freeing each entry.
But this conflicted with the incremental clean up,
leading to double-frees of leftover items.

The easy fix here is to have `archive_entry_linkresolver_free()`
just repeatedly query the list without trying to free, relying
on the incremental clean up mechanism.

Credit: tianshuo han reported the issue and suggested the fix.

4 weeks agoMerge pull request #2952 from solbjorn/ppmd-symbols
Tim Kientzle [Sun, 12 Apr 2026 23:12:07 +0000 (16:12 -0700)] 
Merge pull request #2952 from solbjorn/ppmd-symbols

libarchive/ppmd8: mark the remaining functions static

4 weeks agoMerge pull request #2898 from ElhananHaenel/fix/rar3-lzss-window-realloc
Tim Kientzle [Sun, 12 Apr 2026 22:16:57 +0000 (15:16 -0700)] 
Merge pull request #2898 from ElhananHaenel/fix/rar3-lzss-window-realloc

rar: fix LZSS window size mismatch after PPMd block

4 weeks agoMerge pull request #2934 from ElhananHaenel/fix/zisofs-validate-log2bs
Tim Kientzle [Sun, 12 Apr 2026 22:13:18 +0000 (15:13 -0700)] 
Merge pull request #2934 from ElhananHaenel/fix/zisofs-validate-log2bs

FIX - iso9660: validate pz_log2_bs, add test for 32-bit heap overflow

4 weeks agoMerge pull request #2924 from stoeckmann/pathmatch_pm
Tim Kientzle [Sun, 12 Apr 2026 22:03:02 +0000 (15:03 -0700)] 
Merge pull request #2924 from stoeckmann/pathmatch_pm

pathmatch: Anchors within pattern not special

4 weeks agoMerge pull request #2922 from stoeckmann/err_style_followup
Tim Kientzle [Sun, 12 Apr 2026 22:02:13 +0000 (15:02 -0700)] 
Merge pull request #2922 from stoeckmann/err_style_followup

Improve style of more error messages

4 weeks agoMerge branch 'master' into fix/zisofs-validate-log2bs 2934/head
Tim Kientzle [Sun, 12 Apr 2026 21:57:23 +0000 (14:57 -0700)] 
Merge branch 'master' into fix/zisofs-validate-log2bs

4 weeks agoMerge pull request #2897 from ElhananHaenel/fix/iso_zisofs_undefined_behavior
Tim Kientzle [Sun, 12 Apr 2026 21:51:56 +0000 (14:51 -0700)] 
Merge pull request #2897 from ElhananHaenel/fix/iso_zisofs_undefined_behavior

iso9660: validate pz_log2_bs in parse_rockridge_ZF1()

4 weeks agoAdd regression test for zisofs 32-bit heap overflow
elhananhaenel [Thu, 19 Mar 2026 14:43:29 +0000 (16:43 +0200)] 
Add regression test for zisofs 32-bit heap overflow

A crafted ISO with pz_log2_bs=2 and pz_uncompressed_size=0xFFFFFFF9
causes an integer overflow in the block pointer allocation in
zisofs_read_data(). On 32-bit, (ceil+1)*4 wraps size_t to 0, malloc(0)
returns a tiny buffer, and the code writes ~4GB past it.

The pz_log2_bs validation fix prevents this. Add a regression test with
a crafted 48KB ISO that triggers the overflow on unfixed 32-bit builds.

5 weeks agolibarchive/ppmd8: mark the remaining functions static 2952/head
Alexander Lobakin [Tue, 7 Apr 2026 21:10:47 +0000 (23:10 +0200)] 
libarchive/ppmd8: mark the remaining functions static

Those 9 are not used anywhere outside the file (the actual
functionality is exported as a callback structure).
Make them static for a bit better compiler optimization
opportunities and, more important, to avoid symbol conflict
when static linking libarchive and any library which uses
the original Ppmd*.c from the LZMA SDK (like minizip-ng).

Also remove a couple declarations and macros not used
anywhere at all while we're here.

Signed-off-by: Alexander Lobakin <alobakin@mailbox.org>
6 weeks agoMerge pull request #2947 from fdegros/lzop_support
Tim Kientzle [Sun, 29 Mar 2026 23:34:20 +0000 (16:34 -0700)] 
Merge pull request #2947 from fdegros/lzop_support

LZOP and GRZIP support

6 weeks agoAdd tests 2947/head
François Degros [Mon, 24 Feb 2025 23:19:12 +0000 (10:19 +1100)] 
Add tests

test_read_append_lzop_filter
test_read_append_grzip_filter

Bug: https://github.com/libarchive/libarchive/issues/2513
Test: ./libarchive_test test_read_append_lzop_filter test_read_append_grzip_filter

6 weeks agoFix archive_read_append_filter() for lzop and grzip
Tim Kientzle [Sun, 27 Jul 2025 15:50:03 +0000 (08:50 -0700)] 
Fix archive_read_append_filter() for lzop and grzip

These two filters failed to correctly set a name when
being registered, which prevented them from working
correctly with archive_read_append_filter()

Thanks to @fdegros for the test case demonstrating the lrzip failure

7 weeks agoMerge pull request #2943 from bgilbert/test
Tim Kientzle [Sun, 22 Mar 2026 17:34:40 +0000 (10:34 -0700)] 
Merge pull request #2943 from bgilbert/test

Add v7 tar filename encoding test to Autotools

7 weeks agoAdd v7 tar filename encoding test to Autotools 2943/head
Benjamin Gilbert [Sun, 22 Mar 2026 03:48:19 +0000 (20:48 -0700)] 
Add v7 tar filename encoding test to Autotools

It wasn't being included in the dist tarball.

Fixes: d4cf95cdac ("archive_write: Fix crash on failure to convert WCS/UTF-8 pathname to MBS")
7 weeks agoMerge pull request #2919 from LoboQ1ng/fix-cab-lzx-oob
Tim Kientzle [Sat, 21 Mar 2026 02:11:15 +0000 (19:11 -0700)] 
Merge pull request #2919 from LoboQ1ng/fix-cab-lzx-oob

Fix Heap OOB Write in CAB LZX decoder

7 weeks agobuild: add test files to Makefile.am for autotools compatibility 2919/head
LoboQ1ng [Sat, 21 Mar 2026 00:27:12 +0000 (00:27 +0000)] 
build: add test files to Makefile.am for autotools compatibility

7 weeks agotest: resolve SonarQube code smell by removing redundant conditional
LoboQ1ng [Fri, 20 Mar 2026 21:57:18 +0000 (21:57 +0000)] 
test: resolve SonarQube code smell by removing redundant conditional

7 weeks agoMerge pull request #2939 from stoeckmann/cpio_mem_leak
Tim Kientzle [Fri, 20 Mar 2026 15:44:15 +0000 (08:44 -0700)] 
Merge pull request #2939 from stoeckmann/cpio_mem_leak

cpio: Fix `-R` memory leak

7 weeks agoMerge pull request #2940 from wrp/wrp/doc
Tim Kientzle [Fri, 20 Mar 2026 15:43:08 +0000 (08:43 -0700)] 
Merge pull request #2940 from wrp/wrp/doc

Provide more details on autotool meta-files

7 weeks agoProvide more details on autotool meta-files 2940/head
William Pursell [Fri, 20 Mar 2026 15:03:59 +0000 (09:03 -0600)] 
Provide more details on autotool meta-files

Given the amount of confusion surrounding the autotools, it is
better to have accurate descriptions of these files in the
README.

7 weeks agocpio: Fix -R memory leak 2939/head
Tobias Stoeckmann [Fri, 20 Mar 2026 12:40:19 +0000 (13:40 +0100)] 
cpio: Fix -R memory leak

If the -R command line argument is supplied with user/group names
multiple times, memory leaks occur.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 weeks agopathmatch: Anchors within pattern not special 2924/head
Tobias Stoeckmann [Wed, 18 Mar 2026 10:17:02 +0000 (11:17 +0100)] 
pathmatch: Anchors within pattern not special

The anchor characters ^ and $ have only special meanings if they are
located at the beginning (^) or at the end ($) of the pattern. And even
then they are supposed to be only special if flags are set.

If they are located within the pattern itself, they are regular
characters regardless of flags.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 weeks agozip: Unify error code formatting in error messages 2922/head
Tobias Stoeckmann [Wed, 18 Mar 2026 08:20:01 +0000 (09:20 +0100)] 
zip: Unify error code formatting in error messages

This unifies the way error codes are shown in error messages.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 weeks agorar5: Remove "Error: " prefix from error message
Tobias Stoeckmann [Wed, 18 Mar 2026 08:19:15 +0000 (09:19 +0100)] 
rar5: Remove "Error: " prefix from error message

Unifies style with other error messages.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 weeks agoFix whitespace style in error messages
Tobias Stoeckmann [Wed, 18 Mar 2026 08:15:53 +0000 (09:15 +0100)] 
Fix whitespace style in error messages

- Keep a whitespace between text and brackets
- No whitespace between text and colon
- No newline at end of error message

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 weeks ago7zip: Fix typo in error message
Tobias Stoeckmann [Wed, 18 Mar 2026 08:14:25 +0000 (09:14 +0100)] 
7zip: Fix typo in error message

Failed should be written without capital letter here.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 weeks agoRemove periods from error messages
Tobias Stoeckmann [Wed, 18 Mar 2026 08:12:51 +0000 (09:12 +0100)] 
Remove periods from error messages

Some error messages previously slipped through. Remove periods from
these messages as well.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 weeks agoMerge pull request #2921 from stoeckmann/err_style_regression
Tim Kientzle [Wed, 18 Mar 2026 12:58:45 +0000 (05:58 -0700)] 
Merge pull request #2921 from stoeckmann/err_style_regression

Fix Windows test regression

8 weeks agoFix Windows test regression 2921/head
Tobias Stoeckmann [Wed, 18 Mar 2026 08:03:00 +0000 (09:03 +0100)] 
Fix Windows test regression

By only removing periods from error messages in Windows specific code,
but not adjusting its POSIX counterpart, the test fails on Windows but
not on POSIX systems.

Fix this by removing the period in test and in POSIX error messages.

Fixes: 3e0819b59e ("libarchive: Remove period from error messages")
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 weeks agoMerge pull request #2912 from stoeckmann/pax_ugid
Tim Kientzle [Wed, 18 Mar 2026 03:11:29 +0000 (20:11 -0700)] 
Merge pull request #2912 from stoeckmann/pax_ugid

pax: Remove uid/gid cast in value range check