]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
20 hours agoMerge pull request #2968 from stoeckmann/isofile_gen_utility_names_dotdot master
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

20 hours 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>
20 hours 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>
20 hours 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>
20 hours 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>
21 hours 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>
36 hours 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

36 hours 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`.

36 hours 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.)

2 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

2 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

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

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

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

3 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`).

4 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")
6 days 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

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

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

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

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

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

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

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

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

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

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

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

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

3 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

3 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

4 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

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

4 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

4 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

4 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

4 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

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

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

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

4 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

4 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

4 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

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

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

5 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

5 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

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

5 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

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

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

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

5 weeks agoAdd missing HAVE_STDIO_H cmake check
Tobias Stoeckmann [Mon, 9 Mar 2026 20:00:14 +0000 (21:00 +0100)] 
Add missing HAVE_STDIO_H cmake check

The check is performed by configure, but not with cmake. The
bsdunzip/la_getline.c file checks for presence of this definition.

5 weeks agoMerge pull request #2871 from stoeckmann/archive_options_either
Tim Kientzle [Mon, 16 Mar 2026 02:21:37 +0000 (19:21 -0700)] 
Merge pull request #2871 from stoeckmann/archive_options_either

libarchive: Correctly handle option failures

5 weeks agoMerge pull request #2900 from LoboQ1ng/fix-cab-null-deref
Tim Kientzle [Mon, 16 Mar 2026 01:41:04 +0000 (18:41 -0700)] 
Merge pull request #2900 from LoboQ1ng/fix-cab-null-deref

Fix NULL pointer dereference in CAB parser during skip

5 weeks agoMerge pull request #2903 from ZUENS2020/codex/fix-untar-parseoct-bounds-check
Tim Kientzle [Mon, 16 Mar 2026 01:39:32 +0000 (18:39 -0700)] 
Merge pull request #2903 from ZUENS2020/codex/fix-untar-parseoct-bounds-check

Fix OOB read in contrib/untar.c parseoct()

5 weeks agoMerge pull request #2901 from stoeckmann/cpio_llp64
Tim Kientzle [Mon, 16 Mar 2026 01:39:10 +0000 (18:39 -0700)] 
Merge pull request #2901 from stoeckmann/cpio_llp64

tools: Cast int64_t to long long in printf

5 weeks agoFix NULL pointer dereference in archive_acl_from_text_nl 2905/head
Georgios Patsakas [Thu, 12 Mar 2026 20:24:13 +0000 (22:24 +0200)] 
Fix NULL pointer dereference in archive_acl_from_text_nl

### Summary
This PR fixes a NULL pointer dereference in `archive_acl_from_text_nl()` (located in `archive_acl.c`) that occurs when parsing malformed PAX tar archives containing a short "default" ACL prefix.

### Technical Details
This is a variant of the bug previously fixed in the wide-character version `archive_acl_from_text_w()` via commit 7a6549a6 (Issue #2744).

The vulnerability exists because `st = field[n].start + 1` is calculated before verifying if the field length is zero. In cases of malformed entries, `field[n].start` can be NULL, leading to Undefined Behavior/SIGILL. This patch applies the same logic from the wide-char fix: moving the pointer increment after the length guard.

### Validation
- **Environment:** Ubuntu 24.04, compiled with AddressSanitizer (ASan) and UndefinedBehaviorSanitizer (UBSan).
- **Reproduction:** Verified that the minimized PAX tar archive provided in issue #2904 no longer triggers the crash.
- **Regression:** All existing library tests pass.

Closes #2904

5 weeks agoFix OOB read in contrib/untar.c parseoct() 2903/head
ZUENS2020 [Wed, 11 Mar 2026 13:34:58 +0000 (21:34 +0800)] 
Fix OOB read in contrib/untar.c parseoct()

Reported-by: ZUENS2020
5 weeks agotar: print int64_t uid/gid as long long 2901/head
Tobias Stoeckmann [Tue, 10 Mar 2026 19:10:24 +0000 (20:10 +0100)] 
tar: print int64_t uid/gid as long long

On LLP64 systems like Windows 11, overly large uid/gid values would be
truncated.

Same is true on Linux 32 bit.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 weeks agocpio: Cast int64_t to long long in printf
Tobias Stoeckmann [Tue, 10 Mar 2026 17:20:40 +0000 (18:20 +0100)] 
cpio: Cast int64_t to long long in printf

LLP64 systems like Windows 11 have a 32 bit long. Cast int64_t to
long long for better output.

Same is true for 32 bit systems.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 weeks agoFix NULL pointer dereference in CAB parser during skip 2900/head
LoboQ1ng [Tue, 10 Mar 2026 17:04:43 +0000 (17:04 +0000)] 
Fix NULL pointer dereference in CAB parser during skip

When parsing a malformed CAB file, the skip routine (cab_checksum_finish) blindly calculated the checksum on an uninitialized cfdata->memimage. This patch adds a NULL check before the checksum calculation and includes a standalone test case with a minimized malformed payload to prevent regressions.

5 weeks agoMerge pull request #2877 from kientzle/kientzle-rar5-loop-bug
Tim Kientzle [Tue, 10 Mar 2026 02:52:31 +0000 (19:52 -0700)] 
Merge pull request #2877 from kientzle/kientzle-rar5-loop-bug

Infinite loop in Rar5 decompression

5 weeks agoReject filters when the block length is nonsensical 2877/head
Tim Kientzle [Mon, 2 Mar 2026 04:24:56 +0000 (20:24 -0800)] 
Reject filters when the block length is nonsensical

Credit: Grzegorz Antoniak @antekone

5 weeks agoInfinite loop in Rar5 decompression
Tim Kientzle [Sun, 1 Mar 2026 18:04:01 +0000 (10:04 -0800)] 
Infinite loop in Rar5 decompression

Found by: Elhanan Haenel

6 weeks agoAdd TODO comment for future error propagation 2897/head
elhananhaenel [Sun, 8 Mar 2026 13:33:50 +0000 (15:33 +0200)] 
Add TODO comment for future error propagation

6 weeks agoFix -Wsign-compare: cast mask+1 to unsigned int 2898/head
elhananhaenel [Sun, 8 Mar 2026 13:29:46 +0000 (15:29 +0200)] 
Fix -Wsign-compare: cast mask+1 to unsigned int

6 weeks agorar: fix LZSS window size mismatch after PPMd block
elhananhaenel [Sat, 7 Mar 2026 20:32:09 +0000 (22:32 +0200)] 
rar: fix LZSS window size mismatch after PPMd block

When a PPMd-compressed block updates dictionary_size, the LZSS window
from a prior block is not reallocated. The allocation guard only checks
if dictionary_size is zero or the window pointer is NULL, not whether
the existing window is large enough. This allows copy_from_lzss_window()
to read past the allocated buffer.

Fix the guard to also check whether the current window is undersized.
Add bounds checks in copy_from_lzss_window() and parse_filter() as
defense in depth.

6 weeks agoiso9660: validate pz_log2_bs in parse_rockridge_ZF1()
elhananhaenel [Sat, 7 Mar 2026 20:14:23 +0000 (22:14 +0200)] 
iso9660: validate pz_log2_bs in parse_rockridge_ZF1()

The zisofs block size exponent (pz_log2_bs) read from the Rock Ridge ZF
extension entry is used directly in shift expressions without validation.
The zisofs specification only permits values 15, 16, or 17 (corresponding
to 32K, 64K, and 128K block sizes).

When pz_log2_bs >= 64 on 64-bit systems (or >= 32 on 32-bit), the
expression (size_t)1UL << pz_log2_bs is undefined behavior per C11
6.5.7. On 32-bit systems, a large exponent also causes the block pointer
allocation size computation (ceil + 1) * 4 to overflow to zero, leading
to a heap buffer overflow write after malloc(0).

Fix: reject any pz_log2_bs outside the range [15, 17] by disabling
zisofs for the entry (file->pz = 0), which prevents the zisofs
decompression path from executing.

Found by fuzzing with ASAN/UBSAN.

6 weeks agoMerge pull request #2896 from kientzle/kientzle-fix-omitted-uu
Tim Kientzle [Sat, 7 Mar 2026 18:53:05 +0000 (10:53 -0800)] 
Merge pull request #2896 from kientzle/kientzle-fix-omitted-uu

Add UU file from #2864 to Makefile.am

6 weeks agoAdd UU file from #2864 to Makefile.am 2896/head
Tim Kientzle [Sat, 7 Mar 2026 18:46:43 +0000 (10:46 -0800)] 
Add UU file from #2864 to Makefile.am

6 weeks agoMerge pull request #2889 from OwenSanzas/fix/linkify-fuzzer-double-free
Tim Kientzle [Sat, 7 Mar 2026 18:29:36 +0000 (10:29 -0800)] 
Merge pull request #2889 from OwenSanzas/fix/linkify-fuzzer-double-free

Fix double-free in libarchive_linkify_fuzzer

6 weeks agoMerge pull request #2864 from vdsilva/patch
Tim Kientzle [Sat, 7 Mar 2026 18:15:44 +0000 (10:15 -0800)] 
Merge pull request #2864 from vdsilva/patch

7zip: Fix SEGV in check_7zip_header_in_sfx via ELF offset validation

6 weeks agoMerge pull request #2892 from antekone/feature/8192-filters-memleak/1
Tim Kientzle [Sat, 7 Mar 2026 18:09:26 +0000 (10:09 -0800)] 
Merge pull request #2892 from antekone/feature/8192-filters-memleak/1

RAR5 reader: fix potential memory leak

6 weeks agoMerge pull request #2893 from antekone/feature/github/1963/init-twice/1
Tim Kientzle [Sat, 7 Mar 2026 18:08:49 +0000 (10:08 -0800)] 
Merge pull request #2893 from antekone/feature/github/1963/init-twice/1

RAR5 reader: fix SIGSEGV when archive_read_support_format_rar5 is called twice