]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
3 days agoMerge pull request #3039 from dnelson-1901/manpage-fixes master
Dustin L. Howett [Wed, 3 Jun 2026 05:35:22 +0000 (22:35 -0700)] 
Merge pull request #3039 from dnelson-1901/manpage-fixes

3 days agoMerge pull request #3109 from stoeckmann/windows_concurrency
Dustin L. Howett [Wed, 3 Jun 2026 05:33:10 +0000 (22:33 -0700)] 
Merge pull request #3109 from stoeckmann/windows_concurrency

3 days agoMerge pull request #3112 from stoeckmann/windows_partition
Dustin L. Howett [Wed, 3 Jun 2026 04:58:40 +0000 (21:58 -0700)] 
Merge pull request #3112 from stoeckmann/windows_partition

3 days agoMerge pull request #3106 from stoeckmann/precompute_tables
Tim Kientzle [Wed, 3 Jun 2026 04:10:22 +0000 (21:10 -0700)] 
Merge pull request #3106 from stoeckmann/precompute_tables

Precompute static tables

3 days agoMerge pull request #3107 from stoeckmann/dynamic
Tim Kientzle [Wed, 3 Jun 2026 04:09:33 +0000 (21:09 -0700)] 
Merge pull request #3107 from stoeckmann/dynamic

Turn static state variables dynamic

3 days agoMerge pull request #3110 from stoeckmann/static_style
Tim Kientzle [Wed, 3 Jun 2026 04:08:35 +0000 (21:08 -0700)] 
Merge pull request #3110 from stoeckmann/static_style

Turn two static tables `static const`

3 days agoMerge pull request #3111 from stoeckmann/tests_assert_a
Tim Kientzle [Wed, 3 Jun 2026 04:07:42 +0000 (21:07 -0700)] 
Merge pull request #3111 from stoeckmann/tests_assert_a

tests: Use assertEqualInt for archive_write_free

4 days agowindows: Extend CreateSymbolicLinkW guard 3112/head
Tobias Stoeckmann [Tue, 2 Jun 2026 20:28:33 +0000 (22:28 +0200)] 
windows: Extend CreateSymbolicLinkW guard

Add WINDOWS_PARTITION_SYSTEM to guard for extended supported.
Reported by Duncan Horn.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agowindows: Define WINAPI_FAMILY_PARTITION if missing
Tobias Stoeckmann [Tue, 2 Jun 2026 20:26:17 +0000 (22:26 +0200)] 
windows: Define WINAPI_FAMILY_PARTITION if missing

Define the macro WINAPI_FAMILY_PARTITION if it's missing, which can
happen on old Windows versions like Windows XP. Also add other missing
definitions to support compilation.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agotests: Use assertEqualInt for archive_write_free 3111/head
Tobias Stoeckmann [Tue, 2 Jun 2026 19:34:35 +0000 (21:34 +0200)] 
tests: Use assertEqualInt for archive_write_free

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agowindows: Fix concurrency in __archive_create_child 3109/head
Tobias Stoeckmann [Tue, 2 Jun 2026 19:13:11 +0000 (21:13 +0200)] 
windows: Fix concurrency in __archive_create_child

Use proper memory barrier while checking for availability of function
WaitForInputIdle.

Since Vista, InitOnceExecuteOnce is a very simple idiom to handle such a
singleton setup. For earlier setups, accept a possible data race and
recover gracefully if two concurrent threads performed the initial
setup.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agolz4: Adjust style 3110/head
Tobias Stoeckmann [Tue, 2 Jun 2026 18:53:18 +0000 (20:53 +0200)] 
lz4: Adjust style

Having const right after static makes it easier to grep for array which
are not static const.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agorar5: Turn rar5_signature_xor const
Tobias Stoeckmann [Tue, 2 Jun 2026 18:52:01 +0000 (20:52 +0200)] 
rar5: Turn rar5_signature_xor const

The content is never modified, so move it into read-only section.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agoposix: Move static var into archive_write_disk 3107/head
Tobias Stoeckmann [Tue, 2 Jun 2026 18:28:53 +0000 (20:28 +0200)] 
posix: Move static var into archive_write_disk

Move a static variable into struct archive_write_disk, which is a safe
location from a thread perspective.

Only create and use it if it's really needed, i.e. for systems which
lack support for extended attributes.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agotar: Move static variables into struct tar
Tobias Stoeckmann [Tue, 2 Jun 2026 18:18:02 +0000 (20:18 +0200)] 
tar: Move static variables into struct tar

Move these variables into struct tar, which is populated for every
individual tar archive.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agolha: Precalculate CRC16 tables 3106/head
Tobias Stoeckmann [Tue, 2 Jun 2026 17:41:34 +0000 (19:41 +0200)] 
lha: Precalculate CRC16 tables

This avoids all possible concurrency issues.

As a bonus, turn the whole array const to move it into read-only
section.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agocrc32: Precalculate table
Tobias Stoeckmann [Tue, 2 Jun 2026 17:30:58 +0000 (19:30 +0200)] 
crc32: Precalculate table

This avoids all possible concurrency issues.

As a bonus, turn the whole array const to move it into read-only
section.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agotar: Precalculate decode_table of base64_decode
Tobias Stoeckmann [Tue, 2 Jun 2026 17:31:54 +0000 (19:31 +0200)] 
tar: Precalculate decode_table of base64_decode

This avoids all possible concurrency issues.

As a bonus, turn the whole array const to move it into read-only
section.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agoMerge pull request #3045 from datauwu/iso9660-joliet-patch
Martin Matuška [Tue, 2 Jun 2026 13:06:34 +0000 (15:06 +0200)] 
Merge pull request #3045 from datauwu/iso9660-joliet-patch

iso9660: bound duplicate identifier extension placement

4 days agoMerge pull request #3073 from stoeckmann/lz4_zstd_32
Martin Matuška [Tue, 2 Jun 2026 13:05:42 +0000 (15:05 +0200)] 
Merge pull request #3073 from stoeckmann/lz4_zstd_32

lz4/zstd: Fix 32 bit platform endless loop and OOB access during bidding

4 days agoMerge pull request #3091 from yPin9/fix/rar5-consume-remaining
Martin Matuška [Tue, 2 Jun 2026 13:04:44 +0000 (15:04 +0200)] 
Merge pull request #3091 from yPin9/fix/rar5-consume-remaining

rar5: skip unconsumed block bytes before ARCHIVE_RETRY

4 days agoMerge pull request #3103 from stoeckmann/uu_32_oob
Martin Matuška [Tue, 2 Jun 2026 13:04:00 +0000 (15:04 +0200)] 
Merge pull request #3103 from stoeckmann/uu_32_oob

uu: Extend range checks to avoid 32 bit OOB

4 days agoMerge pull request #2837 from mmatuska/ci-firecracker
Martin Matuška [Tue, 2 Jun 2026 13:03:35 +0000 (15:03 +0200)] 
Merge pull request #2837 from mmatuska/ci-firecracker

CI: add FreeBSD 15 build via firecracker VM to GitHub Actions

4 days agoMerge pull request #3081 from stoeckmann/tests_i686_asan
Tobias Stoeckmann [Tue, 2 Jun 2026 06:12:43 +0000 (08:12 +0200)] 
Merge pull request #3081 from stoeckmann/tests_i686_asan

tests: Skip checks on low memory systems

4 days agoMerge pull request #3104 from stoeckmann/uu_cleanup
Tobias Stoeckmann [Tue, 2 Jun 2026 06:12:22 +0000 (08:12 +0200)] 
Merge pull request #3104 from stoeckmann/uu_cleanup

uu: Minor code cleanups

4 days agouu: Fix grammar in comments 3104/head
Tobias Stoeckmann [Mon, 1 Jun 2026 21:05:36 +0000 (23:05 +0200)] 
uu: Fix grammar in comments

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agouu: Extend range checks to avoid 32 bit OOB 3103/head
Tobias Stoeckmann [Mon, 1 Jun 2026 20:38:37 +0000 (22:38 +0200)] 
uu: Extend range checks to avoid 32 bit OOB

It is possible to trigger an out of boundary write on 32 bit systems
with around 1 GB of data (with a line consuming most of that data) when
opened with archive_read_open_memory.

Cap the amount of data read at once at 2 * UUENCODE_BID_MAX_READ to
allow range checks to take place before a possible SSIZE_MAX overflow
can occur through avail_in. Also, discard any line longer than
UUENCODE_BID_MAX_READ since this should definitely be more than
enough, especially since in_cnt check already takes care of that.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 days agouu: Fix formatting
Tobias Stoeckmann [Mon, 1 Jun 2026 20:53:16 +0000 (22:53 +0200)] 
uu: Fix formatting

No functional change, but clarify where this if-block belongs to.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 days agouu: Remove unneeded code
Tobias Stoeckmann [Mon, 1 Jun 2026 20:52:56 +0000 (22:52 +0200)] 
uu: Remove unneeded code

We know that ptr is NULL, so no need to call free on it.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 days agoMerge pull request #3082 from stoeckmann/bzip2_dead
Dustin L. Howett [Mon, 1 Jun 2026 20:15:06 +0000 (15:15 -0500)] 
Merge pull request #3082 from stoeckmann/bzip2_dead

The check for end of file (`avail == 0`) happens after the check for a `NULL` return value of `__archive_read_filter_ahead`.

Remove it, because at this stage, it's definitely truncated, not just end of file.

5 days agoMerge pull request #3102 from DHowett/bug/7z-build
Dustin L. Howett [Mon, 1 Jun 2026 19:02:14 +0000 (14:02 -0500)] 
Merge pull request #3102 from DHowett/bug/7z-build

7zip: fix a number of issues in zstd detection

- -Wunused-function when ZSTD_compressStream is unavailable
- Incorrect automatic selection of 7Z_ZSTD when ZSTD_compressStream is unavailable
- Other instances of HAVE_ZSTD_H not matching HAVE_LIBZSTD

Co-authored-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 days ago7zip: Support old zstd versions as well 3102/head
Tobias Stoeckmann [Mon, 1 Jun 2026 18:15:31 +0000 (20:15 +0200)] 
7zip: Support old zstd versions as well

Use ZSTD_DStream only if it's available, which should always be the
case.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 days agoMerge pull request #3090 from DHowett/ci/cygwin
Dustin L. Howett [Mon, 1 Jun 2026 17:54:56 +0000 (12:54 -0500)] 
Merge pull request #3090 from DHowett/ci/cygwin

ci: migrate Windows Cygwin to GitHub Actions

5 days ago7zip: only fall back to 7Z_ZSTD if we can actually use zstd
Dustin L. Howett [Mon, 1 Jun 2026 17:38:07 +0000 (13:38 -0400)] 
7zip: only fall back to 7Z_ZSTD if we can actually use zstd

Without this fix, the 7zip writer will fall back to zstd (when it is the
last available option) even if it could not be linked, then fail at
runtime with an unexpected error message.

5 days ago7zip: fix -Wunused-function if zstd.h exists but zstd can't be linked
Dustin L. Howett [Thu, 28 May 2026 22:40:05 +0000 (17:40 -0500)] 
7zip: fix -Wunused-function if zstd.h exists but zstd can't be linked

5 days agoMerge pull request #3094 from i1011/xar-redundant-dec-fix
Dustin L. Howett [Mon, 1 Jun 2026 11:50:50 +0000 (06:50 -0500)] 
Merge pull request #3094 from i1011/xar-redundant-dec-fix

5 days agoci: add the new cygwin-gcc backend to the GitHub CI workflow 3090/head
Dustin L. Howett [Thu, 28 May 2026 21:37:35 +0000 (16:37 -0500)] 
ci: add the new cygwin-gcc backend to the GitHub CI workflow

5 days agoci: add support for cygwin-gcc to the github CI script
Dustin L. Howett [Thu, 28 May 2026 21:47:56 +0000 (16:47 -0500)] 
ci: add support for cygwin-gcc to the github CI script

5 days agoCI: add FreeBSD-15-amd64 build via firecracker 2837/head
Martin Matuska [Mon, 1 Jun 2026 08:06:05 +0000 (10:06 +0200)] 
CI: add FreeBSD-15-amd64 build via firecracker

5 days agoMerge pull request #3089 from mostynb/remove_cirrus_ci
Martin Matuška [Mon, 1 Jun 2026 07:58:42 +0000 (09:58 +0200)] 
Merge pull request #3089 from mostynb/remove_cirrus_ci

Remove Cirrus CI setup, it is shutting down in a few days

5 days agoMerge pull request #3093 from stoeckmann/lz4_skip
Martin Matuška [Mon, 1 Jun 2026 07:55:02 +0000 (09:55 +0200)] 
Merge pull request #3093 from stoeckmann/lz4_skip

lz4: Improve truncated input stream detection

5 days agoMerge pull request #3095 from stoeckmann/afio_header
Martin Matuška [Mon, 1 Jun 2026 07:54:26 +0000 (09:54 +0200)] 
Merge pull request #3095 from stoeckmann/afio_header

cpio: Improve afio header detection

5 days agoMerge pull request #3096 from stoeckmann/filters_comments
Martin Matuška [Mon, 1 Jun 2026 07:53:36 +0000 (09:53 +0200)] 
Merge pull request #3096 from stoeckmann/filters_comments

filters: Update comments

5 days agoMerge pull request #3097 from stoeckmann/typos
Martin Matuška [Mon, 1 Jun 2026 07:53:20 +0000 (09:53 +0200)] 
Merge pull request #3097 from stoeckmann/typos

Fix typos in comments and error message

5 days agoMerge pull request #3099 from stoeckmann/7zip_seek
Martin Matuška [Mon, 1 Jun 2026 07:51:32 +0000 (09:51 +0200)] 
Merge pull request #3099 from stoeckmann/7zip_seek

7zip: Extend support for filtered input

5 days agoMerge pull request #3100 from stoeckmann/lz4_xxh32
Martin Matuška [Mon, 1 Jun 2026 07:50:34 +0000 (09:50 +0200)] 
Merge pull request #3100 from stoeckmann/lz4_xxh32

lz4: Check `XXH32_init` result

6 days agolz4: Check XXH32_init result 3100/head
Tobias Stoeckmann [Sun, 31 May 2026 15:41:41 +0000 (17:41 +0200)] 
lz4: Check XXH32_init result

The XXH32_init function allocates memory. Check if the allocation was
successful and return ARCHIVE_FATAL on error.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 days agofilters: Update comments 3096/head
Tobias Stoeckmann [Sun, 31 May 2026 09:02:55 +0000 (11:02 +0200)] 
filters: Update comments

Some filter comments were not updated when the execution of external
filter programs was introduced.

Sync them with reality, including the actually performed commands.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 days agoFix typo in manual page 3097/head
Tobias Stoeckmann [Sun, 31 May 2026 15:13:50 +0000 (17:13 +0200)] 
Fix typo in manual page

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 days agoread: Fix typo in error message
Tobias Stoeckmann [Sun, 31 May 2026 09:06:39 +0000 (11:06 +0200)] 
read: Fix typo in error message

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 days agoFix typos in comments
Tobias Stoeckmann [Sun, 31 May 2026 09:06:30 +0000 (11:06 +0200)] 
Fix typos in comments

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 days ago7zip: Extend support for filtered input 3099/head
Tobias Stoeckmann [Sun, 31 May 2026 13:40:23 +0000 (15:40 +0200)] 
7zip: Extend support for filtered input

The 7-ZIP archives written by libarchive can be streamed. Support such
archives by using a fallback if seek is not supported: As long as the
target position is somewhere ahead in stream, consume bytes until the
position is reached.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 days agocpio: Improve afio header detection 3095/head
Tobias Stoeckmann [Sat, 30 May 2026 19:09:28 +0000 (21:09 +0200)] 
cpio: Improve afio header detection

Do not assume that enough bytes will be provided by filter if not
explicitly requested. The requested size is 76, but some checks expect
116 bytes. If these were not supplied by filter, th afio header
detection erroneously skips headers which otherwise could be found.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
7 days agocpio: Prevent signed integer overflow
Tobias Stoeckmann [Sat, 30 May 2026 19:05:02 +0000 (21:05 +0200)] 
cpio: Prevent signed integer overflow

If enough bytes have to be skipped, a signed integer overflow could
occur (most realistically on 32 bit systems). Use an unsigned type,
which could still overflow but has only negative impact on diagnostic
warning message.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
7 days agocpio: Add afio header split test
Tobias Stoeckmann [Fri, 29 May 2026 21:36:44 +0000 (23:36 +0200)] 
cpio: Add afio header split test

Verify that afio headers are detected even on unfortunate filter read
splits, i.e. when magic is found but rest of header has yet to be
retrieved.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
7 days agoxar: Remove redundant decrement in xar_finish_entry 3094/head
i1011 [Sat, 30 May 2026 17:23:39 +0000 (01:23 +0800)] 
xar: Remove redundant decrement in xar_finish_entry

7 days agoxar: Add test for redundant decrement in xar_finish_entry
i1011 [Sat, 30 May 2026 17:22:32 +0000 (01:22 +0800)] 
xar: Add test for redundant decrement in xar_finish_entry

7 days agorar5: consume unconsumed block bytes before ARCHIVE_RETRY 3091/head
yPin9 [Sat, 30 May 2026 12:19:25 +0000 (20:19 +0800)] 
rar5: consume unconsumed block bytes before ARCHIVE_RETRY

process_base_block() returned ARCHIVE_RETRY for HEAD_MAIN (and
HFL_SKIP_IF_UNKNOWN) blocks without consuming the body bytes the
sub-parser did not read. rar5_read_header() then re-parsed the same
region, turning an O(1) skip into O(N) and letting a crafted RAR5 file
stall the reader (GHSA-9h2c-464f-j3hj).

Record the block body start and skip any unconsumed bytes through a
small helper rar5_skip_remaining_block() before returning ARCHIVE_RETRY.

Add two regression tests derived from test_read_format_rar5_stored, each
with extra unread bytes appended to a no-data block's body (HEAD_MAIN and
an unknown HFL_SKIP_IF_UNKNOWN block); both fail on master and pass with
the fix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
8 days agoMerge pull request #3088 from mostynb/improve_bsdtar_subst_error_messages
Dustin L. Howett [Fri, 29 May 2026 18:48:14 +0000 (13:48 -0500)] 
Merge pull request #3088 from mostynb/improve_bsdtar_subst_error_messages

tar: Improve -s Invalid replacement string error messages

8 days agolz4: Detect truncation in lz4_filter_read 3093/head
Tobias Stoeckmann [Thu, 28 May 2026 15:43:32 +0000 (17:43 +0200)] 
lz4: Detect truncation in lz4_filter_read

If __archive_read_filter_consume fails, report information about
detected truncation.

In many cases, the return value can be ignored since
__archive_read_ahead already performed the check. In this case, we never
read the data before, so add the check here.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 days agolz4: Avoid integer overflow in lz4_filter_read
Tobias Stoeckmann [Thu, 28 May 2026 15:39:41 +0000 (17:39 +0200)] 
lz4: Avoid integer overflow in lz4_filter_read

Integer promotion stops at unsigned int, thus addition of 4 to a
uint32_t can lead to an integer overflow.

Use int64_t to support all values.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 days agolz4: Add check for proper byte skipping
Tobias Stoeckmann [Fri, 29 May 2026 15:34:46 +0000 (17:34 +0200)] 
lz4: Add check for proper byte skipping

Check if truncated input is detected while skipping data.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 days agoMerge pull request #3085 from stoeckmann/gzip_check
Tobias Stoeckmann [Fri, 29 May 2026 16:00:49 +0000 (18:00 +0200)] 
Merge pull request #3085 from stoeckmann/gzip_check

gzip: Support more large in-memory archives

8 days agoMerge pull request #3092 from vmihalis/https-config-fetch
Tim Kientzle [Fri, 29 May 2026 16:00:39 +0000 (09:00 -0700)] 
Merge pull request #3092 from vmihalis/https-config-fetch

build: fetch config.guess/config.sub over HTTPS

8 days agobuild: fetch config.guess/config.sub over HTTPS in release Dockerfile 3092/head
Michalis Vasileiadis [Fri, 29 May 2026 13:30:38 +0000 (21:30 +0800)] 
build: fetch config.guess/config.sub over HTTPS in release Dockerfile

Switch the config.guess/config.sub ADD fetches from http:// to https://
(CWE-494).

8 days agobuild: fetch config.guess/config.sub over HTTPS in makerelease.sh
Michalis Vasileiadis [Fri, 29 May 2026 13:30:34 +0000 (21:30 +0800)] 
build: fetch config.guess/config.sub over HTTPS in makerelease.sh

Switch the release-time config.guess/config.sub fetches from http:// to
https:// and add -fsSL so a failed fetch errors out instead of writing an
error page into the helper script (CWE-494).

8 days agoRemove Cirrus CI setup, it is shutting down in a few days 3089/head
Mostyn Bramley-Moore [Thu, 28 May 2026 22:45:38 +0000 (00:45 +0200)] 
Remove Cirrus CI setup, it is shutting down in a few days

https://circleci.com/blog/cirrus-ci-alternative/
> On April 7, the Cirrus Labs team announced they are joining OpenAI.
> As a result, Cirrus CI will stop running jobs on June 1, 2026.

8 days agotar: Improve -s Invalid replacement string error messages 3088/head
Mostyn Bramley-Moore [Thu, 28 May 2026 22:28:08 +0000 (00:28 +0200)] 
tar: Improve -s Invalid replacement string error messages

We can add a bit more context here, to make the error easier to understand.

8 days agoMerge pull request #3079 from i1011/win-ci-missing-errcheck-fix
Dustin L. Howett [Thu, 28 May 2026 21:56:46 +0000 (16:56 -0500)] 
Merge pull request #3079 from i1011/win-ci-missing-errcheck-fix

CI: Add missing exit on error in windows CI

8 days agoMerge pull request #3087 from stoeckmann/cygwin_rar
Dustin L. Howett [Thu, 28 May 2026 21:56:36 +0000 (16:56 -0500)] 
Merge pull request #3087 from stoeckmann/cygwin_rar

rar: Simplify FILE_ATTRIBUTE_DIRECTORY check

8 days agorar: Simplify FILE_ATTRIBUTE_DIRECTORY check 3087/head
Tobias Stoeckmann [Wed, 27 May 2026 20:01:45 +0000 (22:01 +0200)] 
rar: Simplify FILE_ATTRIBUTE_DIRECTORY check

Just check if the definition exists. If not, create it.
Fixes Cygwin build.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
9 days agoMerge pull request #3083 from stoeckmann/read_int_overflow
Tobias Stoeckmann [Thu, 28 May 2026 20:46:43 +0000 (22:46 +0200)] 
Merge pull request #3083 from stoeckmann/read_int_overflow

Fix integer overflow in __archive_read_filter_ahead

9 days agoMerge pull request #3084 from stoeckmann/filters_total_out
Tobias Stoeckmann [Thu, 28 May 2026 20:46:23 +0000 (22:46 +0200)] 
Merge pull request #3084 from stoeckmann/filters_total_out

Drop total_out tracking from read filters

10 days agogzip: Support more large in-memory archives 3085/head
Tobias Stoeckmann [Wed, 27 May 2026 20:40:11 +0000 (22:40 +0200)] 
gzip: Support more large in-memory archives

Apply same logic of gzip_filter_read from commit
256c71ad4eee22a7dac2f13df1e20d85717cbdf6
to consumer_header, which contains the identical issue.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agoDrop total_out tracking from read filters 3084/head
Tobias Stoeckmann [Wed, 27 May 2026 20:37:24 +0000 (22:37 +0200)] 
Drop total_out tracking from read filters

The variable is never read and it only allows a very unlikely integer
overflow if more than INT64_MAX bytes are read.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agoMerge pull request #3080 from stoeckmann/tests_skip
Tobias Stoeckmann [Wed, 27 May 2026 20:01:10 +0000 (22:01 +0200)] 
Merge pull request #3080 from stoeckmann/tests_skip

tests: Fix memory leaks when skipping

10 days agoFix integer overflow in __archive_read_filter_ahead 3083/head
Tobias Stoeckmann [Wed, 27 May 2026 19:54:42 +0000 (21:54 +0200)] 
Fix integer overflow in __archive_read_filter_ahead

The pointer arithmetic could overflow with a large min value. Prevent
this by using subtraction instead of addition.

Resolves #3025.

Co-authored-by: ypp <alen0421@gmail.com>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agobzip2: Remove dead code 3082/head
Tobias Stoeckmann [Wed, 27 May 2026 19:19:09 +0000 (21:19 +0200)] 
bzip2: Remove dead code

The check for end of file (avail == 0) happens after the check for a
NULL return value of __archive_read_filter_ahead.

Remove it, because at this stage, it's definitely truncated, not just
end of file.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agotests: Skip checks on low memory systems 3081/head
Tobias Stoeckmann [Wed, 27 May 2026 18:49:29 +0000 (20:49 +0200)] 
tests: Skip checks on low memory systems

If not enough memory is available, skip tests. This can happen on 32 bit
systems with ASAN enabled. While these tests run perfectly fine if run
directly with libarchive_test, the test harness fails with eventual NULL
pointer dereferences, since these assert-checks do not stop processing.

Happens with lzma and xz and compression level 9.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agotests: Fix memory leaks when skipping 3080/head
Tobias Stoeckmann [Wed, 27 May 2026 18:09:00 +0000 (20:09 +0200)] 
tests: Fix memory leaks when skipping

Release all resources when skipping to avoid ASAN memory leak warnings.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agoCI: Add missing exit on error in windows CI 3079/head
i1011 [Wed, 27 May 2026 17:32:04 +0000 (01:32 +0800)] 
CI: Add missing exit on error in windows CI

10 days agoMerge pull request #3061 from tosanjay/warc-header-popul-ehdr-leak
Tim Kientzle [Wed, 27 May 2026 04:02:28 +0000 (21:02 -0700)] 
Merge pull request #3061 from tosanjay/warc-header-popul-ehdr-leak

warc writer: free hdr on _popul_ehdr overflow in _warc_header

10 days agoMerge pull request #3078 from vlmarek/solaris-skip-string-conversion-fail-tests
Tim Kientzle [Wed, 27 May 2026 03:29:44 +0000 (20:29 -0700)] 
Merge pull request #3078 from vlmarek/solaris-skip-string-conversion-fail-tests

Skip tests where Solaris iconv substitutes invalid chars

10 days agoMerge pull request #3067 from fdegros/fix-7z-seek-null-error
Dustin L. Howett [Tue, 26 May 2026 22:35:41 +0000 (17:35 -0500)] 
Merge pull request #3067 from fdegros/fix-7z-seek-null-error

7-Zip: Set error message in case of error

10 days ago7-Zip: Set error message when reading ahead fails 3067/head
François Degros [Mon, 25 May 2026 05:27:37 +0000 (15:27 +1000)] 
7-Zip: Set error message when reading ahead fails

Nice to have more explicit error messages.

10 days ago7-Zip: Set error message when seeking fails
François Degros [Mon, 25 May 2026 05:27:21 +0000 (15:27 +1000)] 
7-Zip: Set error message when seeking fails

Avoid (null) error message when seeking fails (e.g. on filtered
streams).

Fixes #2956

11 days agoMerge pull request #3077 from stoeckmann/32build
Tobias Stoeckmann [Tue, 26 May 2026 20:06:54 +0000 (22:06 +0200)] 
Merge pull request #3077 from stoeckmann/32build

32 bit: Fix compile warnings and test failure

11 days agoSkip tests where Solaris iconv substitutes invalid chars 3078/head
Vladimír Marek [Tue, 26 May 2026 19:27:05 +0000 (21:27 +0200)] 
Skip tests where Solaris iconv substitutes invalid chars

Solaris iconv may perform an implementation-defined conversion for
non-identical characters instead of failing. In the tested conversions it
substitutes question marks and reports success, so these negative tests do
not match Solaris behavior.

11 days agoMerge pull request #3049 from KongQBin/master
Dustin L. Howett [Tue, 26 May 2026 19:38:40 +0000 (14:38 -0500)] 
Merge pull request #3049 from KongQBin/master

build: fix global state leakage in crypto/library checks

11 days agoMerge pull request #3075 from stoeckmann/tests_close
Dustin L. Howett [Tue, 26 May 2026 19:24:46 +0000 (14:24 -0500)] 
Merge pull request #3075 from stoeckmann/tests_close

tests: Use assertEqualIntA for archive_*_close

11 days agotests: Fix 32 bit time_t check 3077/head
Tobias Stoeckmann [Tue, 26 May 2026 19:17:01 +0000 (21:17 +0200)] 
tests: Fix 32 bit time_t check

On systems with a 32 bit time_t, archive_parse_date covers less values
than with a 64 bit time_t.

Adjust the expected return value for an overly large value.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
11 days ago7zip: Fix format modifier in init_decompression
Tobias Stoeckmann [Tue, 26 May 2026 19:16:28 +0000 (21:16 +0200)] 
7zip: Fix format modifier in init_decompression

The codec field is of type uint64_t, which is an unsigned long on many
64 bit platforms (LP64), but 32 bit platforms and LLP64 platforms cannot
use the l modifier for correct output.

Cast to uintmax_t for portable j support.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
11 days agoMerge pull request #2972 from stoeckmann/rr_moved
Tobias Stoeckmann [Tue, 26 May 2026 19:14:32 +0000 (21:14 +0200)] 
Merge pull request #2972 from stoeckmann/rr_moved

iso9660: Add test for #2978

11 days agoiso9660: Add Rock Ridge regression test 2972/head
Tobias Stoeckmann [Mon, 20 Apr 2026 18:29:17 +0000 (20:29 +0200)] 
iso9660: Add Rock Ridge regression test

The Rock Ridge rr_move functionality for paths with a depth larger than 8
has a few bugs in it. For one, it might loop over the same entries over
and over. And second, rr_move/ directory entries are not verified to be
unique. Both issues can lead to NULL pointer dereferences.

Add a test case which highlights the NULL pointer dereference.

Based on issue #2936.

11 days agoMerge pull request #3055 from stoeckmann/cpio_uaf
Dustin L. Howett [Tue, 26 May 2026 19:00:53 +0000 (14:00 -0500)] 
Merge pull request #3055 from stoeckmann/cpio_uaf

cpio: Fix UAF in error path
Add entry only after its full initialization into list. Otherwise the error handling of a failing strdup would have to unlink the entry again.

Fixes: 16ad9310733e ("cpio reader: Validate pathname in record_hardlink")
Resolves #3053.

11 days agotests: Use assertEqualIntA for archive_*_close 3075/head
Tobias Stoeckmann [Tue, 26 May 2026 18:54:42 +0000 (20:54 +0200)] 
tests: Use assertEqualIntA for archive_*_close

In case of errors, assertEqualIntA offers more information by accessing
archive's errno and error message.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
11 days agoMerge pull request #3050 from stoeckmann/bzip2_large
Tobias Stoeckmann [Tue, 26 May 2026 18:00:19 +0000 (20:00 +0200)] 
Merge pull request #3050 from stoeckmann/bzip2_large

bzip2: Support large in-memory archives

11 days agoMerge pull request #3072 from stoeckmann/tests_free
Tobias Stoeckmann [Tue, 26 May 2026 17:59:56 +0000 (19:59 +0200)] 
Merge pull request #3072 from stoeckmann/tests_free

tests: Avoid assertEqualIntA with archive_*_free

11 days agoMerge pull request #3074 from stoeckmann/7zip_stream
Tobias Stoeckmann [Tue, 26 May 2026 17:59:38 +0000 (19:59 +0200)] 
Merge pull request #3074 from stoeckmann/7zip_stream

7zip: Support streamable reading again

11 days agobuild: fix global state leakage in crypto/library checks 3049/head
KongQBin [Tue, 19 May 2026 10:19:53 +0000 (18:19 +0800)] 
build: fix global state leakage in crypto/library checks

The CMake build script was modifying global CMake variables (CMAKE_REQUIRED_LIBRARIES
and CMAKE_REQUIRED_INCLUDES) during crypto library checks (OpenSSL, MbedTLS, Nettle)
and Haiku libbsd checks without saving/restoring them using
CMAKE_PUSH_CHECK_STATE() and CMAKE_POP_CHECK_STATE().

This caused side effects where subsequent system-level checks (like
CHECK_TYPE_SIZE or CHECK_FUNCTION_EXISTS) inherited these library dependencies,
leading to incorrect feature detection in cross-compilation environments
(e.g., reporting that basic types like 'pid_t' are missing).

This patch ensures all such checks are properly scoped, improving build
robustness across different architectures (x86_64, AArch64, MIPS64, LoongArch64, etc.)
and cross-toolchain environments.