]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
2 days agoMerge pull request #2526 from fdegros/compress_support master
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 days 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 days 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 days 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 days 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 days 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 days 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 days 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

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

3 days 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

4 days 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.

4 days 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

5 days 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`).

6 days 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`

6 days 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>
7 days 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

7 days 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

7 days 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.

7 days 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.

7 days 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")
7 days 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>
8 days 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

8 days 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>
8 days 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>
8 days 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>
8 days 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>
8 days 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>
9 days 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

9 days 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`.

9 days 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.)

9 days 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

9 days 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.

10 days 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

10 days 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

10 days 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")

10 days 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.

11 days 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`

11 days 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`).

12 days 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")
2 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

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

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

2 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.

2 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

2 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

2 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

2 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

2 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

2 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

2 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()

2 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.

2 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>
4 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

4 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

4 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

5 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

5 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")
5 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

5 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

5 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

5 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

5 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

5 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.

5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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

5 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>
5 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

5 weeks agoMerge pull request #2913 from stoeckmann/cpio_buff
Tim Kientzle [Wed, 18 Mar 2026 03:09:54 +0000 (20:09 -0700)] 
Merge pull request #2913 from stoeckmann/cpio_buff

cpio: Reduce visibility of variable buff

5 weeks agoMerge pull request #2915 from stoeckmann/err_style
Tim Kientzle [Wed, 18 Mar 2026 03:07:55 +0000 (20:07 -0700)] 
Merge pull request #2915 from stoeckmann/err_style

libarchive: Improve error message style

5 weeks agoFix Heap OOB Write in CAB LZX decoder
LoboQ1ng [Wed, 18 Mar 2026 00:24:40 +0000 (00:24 +0000)] 
Fix Heap OOB Write in CAB LZX decoder

6 weeks agolibarchive: Fix error message style 2915/head
Tobias Stoeckmann [Tue, 17 Mar 2026 09:47:52 +0000 (10:47 +0100)] 
libarchive: Fix error message style

Remove space in front of colon to match rest of messages.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agolibarchive: Remove "Failed : " error prefixes
Tobias Stoeckmann [Tue, 17 Mar 2026 09:46:25 +0000 (10:46 +0100)] 
libarchive: Remove "Failed : " error prefixes

Calling archive_set_error with a message and errno already indicates
that a failure occurred. Only a minority of functions did that: Unify
with the rest.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agolibarchive: Remove period from error messages
Tobias Stoeckmann [Tue, 17 Mar 2026 09:41:25 +0000 (10:41 +0100)] 
libarchive: Remove period from error messages

The error messages are mostly written without a period. This makes
sense, because they can be accompanied with a strerror(errno) call,
giving more information: most likely a colon is appended.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agocpio: Reduce visibility of variable buff 2913/head
Tobias Stoeckmann [Tue, 17 Mar 2026 09:08:42 +0000 (10:08 +0100)] 
cpio: Reduce visibility of variable buff

The buff variable is only used in entry_to_archive. Moving it into the
specific code block where it is actually used reduces its visibility and
thus makes it easier to read the code:

Since Windows indeed uses unsigned for read, this makes it much easier
to verify that buff never grows and cannot be too large.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agopax: Remove uid/gid cast in value range check 2912/head
Tobias Stoeckmann [Tue, 17 Mar 2026 08:35:55 +0000 (09:35 +0100)] 
pax: Remove uid/gid cast in value range check

The API allows to set int64_t uid/gid values. When writing pax archives,
such large values are properly set in the USTAR header of actual data in
base256, i.e. everything works.

The pax header entries might be missing though because the check
truncates these values to unsigned int. Larger values could be truncated
in a way that they seem smaller than (1 << 18).

The check in line 1427 which sets the uid/gid values into the PAX header
block is correct, truncating the actual value to max. octal
representation.

This is a purely defensive change to support parsers which actually
allow such large uid/gid values but do not understand base256 encoding.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agoMerge pull request #2911 from stoeckmann/libarchive_opt_vals
Tim Kientzle [Mon, 16 Mar 2026 21:01:33 +0000 (14:01 -0700)] 
Merge pull request #2911 from stoeckmann/libarchive_opt_vals

libarchive: Check number ranges of supplied option values

6 weeks agolibarchive/{b64,uu}: Improve atol8 checks 2911/head
Tobias Stoeckmann [Mon, 16 Mar 2026 15:00:30 +0000 (16:00 +0100)] 
libarchive/{b64,uu}: Improve atol8 checks

Make sure that supplied values cannot overflow int64_t, which would be
an undefined behavior. Also do not accept empty strings as numbers.

Last but not least, check values before casting them to target data
types to avoid truncations.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agolibarchive: Check strto(u)l results before casts
Tobias Stoeckmann [Mon, 16 Mar 2026 14:59:12 +0000 (15:59 +0100)] 
libarchive: Check strto(u)l results before casts

Make sure that supplied option values fit into data types. If not,
return an error instead of silently truncating values.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agolibarchive/7zip: Properly check strto* errno value
Tobias Stoeckmann [Mon, 16 Mar 2026 14:57:17 +0000 (15:57 +0100)] 
libarchive/7zip: Properly check strto* errno value

Set errno to 0 before calling strtoimax/strtol and check its value
afterwards.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agolibarchive/gzip: Check strdup return value
Tobias Stoeckmann [Mon, 16 Mar 2026 14:54:16 +0000 (15:54 +0100)] 
libarchive/gzip: Check strdup return value

Handle strdup error instead of silently ignoring the option.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agoMerge pull request #2910 from stoeckmann/cpio_num
Tim Kientzle [Mon, 16 Mar 2026 13:56:31 +0000 (06:56 -0700)] 
Merge pull request #2910 from stoeckmann/cpio_num

cpio: Check number arguments before casts

6 weeks agoMerge pull request #2909 from stoeckmann/lafe_error
Tim Kientzle [Mon, 16 Mar 2026 13:47:14 +0000 (06:47 -0700)] 
Merge pull request #2909 from stoeckmann/lafe_error

tools: Remove `Error : ` prefix in lafe_errc calls

6 weeks agoMerge pull request #2908 from stoeckmann/cpio_mode
Tim Kientzle [Mon, 16 Mar 2026 13:46:38 +0000 (06:46 -0700)] 
Merge pull request #2908 from stoeckmann/cpio_mode

cpio: Improve mode option handling

6 weeks agocpio: Set lafe_warnc code to 0 2910/head
Tobias Stoeckmann [Mon, 16 Mar 2026 13:34:32 +0000 (14:34 +0100)] 
cpio: Set lafe_warnc code to 0

Otherwise an unknown error is printed, which does not help the user
(especially since a custom message is printed in this case already).

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agoMerge pull request #2872 from stoeckmann/filter_options_failed
Tim Kientzle [Mon, 16 Mar 2026 13:30:07 +0000 (06:30 -0700)] 
Merge pull request #2872 from stoeckmann/filter_options_failed

filter options: Use ARCHIVE_FAILED on errors

6 weeks agoMerge pull request #2899 from stoeckmann/cpio_rename
Tim Kientzle [Mon, 16 Mar 2026 13:28:55 +0000 (06:28 -0700)] 
Merge pull request #2899 from stoeckmann/cpio_rename

cpio: Allow long paths with -r option

6 weeks agocpio: Check number arguments before casts
Tobias Stoeckmann [Mon, 16 Mar 2026 13:10:50 +0000 (14:10 +0100)] 
cpio: Check number arguments before casts

Make sure that supplied arguments actually fit into target data types.
Print an error if numbers are too large instead of silently truncating
them.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agotools: Remove 'Error : ' prefix in lafe_errc calls 2909/head
Tobias Stoeckmann [Mon, 16 Mar 2026 13:01:56 +0000 (14:01 +0100)] 
tools: Remove 'Error : ' prefix in lafe_errc calls

Only a minority of calls to lafe_errc state explicitly that an error
occurred. Remove these few cases for a more unified argument handling.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agocpio: Clarify that onyl one mode is acceptable 2908/head
Tobias Stoeckmann [Mon, 16 Mar 2026 12:50:42 +0000 (13:50 +0100)] 
cpio: Clarify that onyl one mode is acceptable

Do not print that at least one mode has to be supplied. Exactly one mode
has to be supplied instead.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agocpio: Improve mode argument checks
Tobias Stoeckmann [Mon, 16 Mar 2026 09:16:19 +0000 (10:16 +0100)] 
cpio: Improve mode argument checks

Complain only if contradicting mode options are supplied. Passing the
same argument multiple times should not lead to errors.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agofilter options: Use ARCHIVE_FAILED on errors 2872/head
Tobias Stoeckmann [Sun, 22 Feb 2026 14:49:27 +0000 (15:49 +0100)] 
filter options: Use ARCHIVE_FAILED on errors

If a filter option is recognized but its value is invalid, return
ARCHIVE_FAILED instead of ARCHIVE_WARN. The latter is used for unknown
options, e.g. at the end of the option setter functions.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 weeks agocpio: Use getline in cpio_rename 2899/head
Tobias Stoeckmann [Mon, 9 Mar 2026 20:40:09 +0000 (21:40 +0100)] 
cpio: Use getline in cpio_rename

The buffer has a fixed 1024 limit, which can be smaller than the maximum
allowed path length. Increasing the limit to 4096 would partially help,
but since leading spaces are stripped, input lines could be valid and
longer.

Use getline instead.

6 weeks agocpio: Refactor cpio_rename
Tobias Stoeckmann [Mon, 9 Mar 2026 20:35:09 +0000 (21:35 +0100)] 
cpio: Refactor cpio_rename

Let cpio_rename work with the entry directly. In this initial step, it
moves buff into the stack.

The comment suggests that this was done in the past already.

6 weeks agoMove la_getline into libarchive_fe
Tobias Stoeckmann [Mon, 9 Mar 2026 20:28:00 +0000 (21:28 +0100)] 
Move la_getline into libarchive_fe

This allows easier reuse of the getline implementation in other tools
like cpio (in upcoming commit).