]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
3 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>
3 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>
3 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

3 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

3 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

3 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

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

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

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

4 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

4 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

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

6 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

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

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

7 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

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

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

8 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

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

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

10 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

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

10 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

10 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

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

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

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

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

10 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

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

11 days ago7zip: Support streamable reading again 3074/head
Tobias Stoeckmann [Mon, 25 May 2026 21:45:34 +0000 (23:45 +0200)] 
7zip: Support streamable reading again

The slurp_central_directory function has been changed to always use
seek, which is not needed and also breaks streamable 7-Zip archives.

Resolves an issue observed in #3068.

Fixes: 71ef1c385249 ("7zip: Merge skip_sfx into get_data_offset")
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
11 days agolz4/zstd: Fix integer overflows while bidding 3073/head
Tobias Stoeckmann [Mon, 25 May 2026 19:09:10 +0000 (21:09 +0200)] 
lz4/zstd: Fix integer overflows while bidding

The C standard dictates that integer promotion increases data types up
to int or the largest argument in arithmetic.

This becomes problematic in `offset_in_buffer += 4 + frame_data_size`
which effectively is `size_t += int + uint32_t`.

If frame_data_size is UINT32_MAX, adding 4 overflows before the
overflown value is added to size_t.

On 32 bit systems, this can easily lead to an endless loop or out of
boundary access.

Fix this by properly checking if integer overflows would occur.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
11 days agozstd: Check for endless loop on 32 bit systems
Tobias Stoeckmann [Mon, 25 May 2026 18:59:44 +0000 (20:59 +0200)] 
zstd: Check for endless loop on 32 bit systems

It is possible to trigger an endless loop on 32 bit systems due to
a triggerable integer overflow.

Add a regression test for this.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
11 days agolz4/zstd: Use correct data types while bidding
Tobias Stoeckmann [Mon, 25 May 2026 18:56:12 +0000 (20:56 +0200)] 
lz4/zstd: Use correct data types while bidding

Use size_t where size_t arguments are expected (and cast avail to size_t
because we know at this point that it cannot be negative).

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
11 days agolz4/zstd: Apply style guide in bidding function
Tobias Stoeckmann [Mon, 25 May 2026 18:52:01 +0000 (20:52 +0200)] 
lz4/zstd: Apply style guide in bidding function

Use C comments, define variables at start of block, keep 80 chars per
line. While at it, turn a few variables const to clarify that they do
not change.

No functional change.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
11 days agotests: Avoid assertEqualIntA with archive_*_free 3072/head
Tobias Stoeckmann [Mon, 25 May 2026 18:36:39 +0000 (20:36 +0200)] 
tests: Avoid assertEqualIntA with archive_*_free

In case of errors, assertEqualIntA accesses the given archive and prints
diagnostic information about errno and error string.

Since archive_read_free and archive_write_free free the memory of the
archive, this would just lead to memory issues in case of errors.

Use assertEqualInt instead.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
12 days ago warc writer: free hdr on _popul_ehdr overflow in _warc_header 3061/head
SanjayR [Fri, 22 May 2026 05:03:56 +0000 (10:33 +0530)] 
  warc writer: free hdr on _popul_ehdr overflow in _warc_header

  _warc_header() initialises a local archive_string hdr, fills it via
  _popul_ehdr(), and frees it on the success path at the bottom. The
  intermediate error return on r < 0 (the populated header exceeds
  MAX_HDR_SIZE=512, reachable with a long enough pathname carried by
  WARC-Target-URI) returns ARCHIVE_WARN without freeing hdr.

  By the time _popul_ehdr returns -1 hdr already holds the WARC version
  line, WARC-Type, WARC-Target-URI (long path), WARC-Date, Last-Modified,
  WARC-Record-ID, and Content-Length headers --- ~1 KB+ per entry in
  practice.

  Reproduces with the bundled bsdtar against a regular file with a
  ~400+ char pathname:
      ASAN_OPTIONS=detect_leaks=1 bsdtar --format=warc -cf out.warc <long_path>
  => LeakSanitizer: ~1 KB direct leak; stack pierces _popul_ehdr ->
     _warc_header (archive_write_set_format_warc.c:245) ->
     _archive_write_header -> ... -> main.

  Code unchanged since the file's introduction in 2014; no existing test
  exercises the long-pathname path. The warcinfo branch above (line ~217)
  handles this correctly already (frees hdr unconditionally outside the
  "if (r >= 0)" block); only the WT_RSRC branch was missed.

  Identified by Neurolog, a code-analysis tool the reporter is developing
  that combines Souffle Datalog with LLM-assisted fact extraction. The
  reproducer was hand-validated under LeakSanitizer against current master.

12 days agoMerge pull request #2790 from LumioseSil/SetFilePointerEx_perso
Dustin L. Howett [Sun, 24 May 2026 19:59:52 +0000 (14:59 -0500)] 
Merge pull request #2790 from LumioseSil/SetFilePointerEx_perso

Replace SetFilePointerEx_perso (local reimplementation) with SetFilePointerEx,
as we no longer need to support Windows XP

12 days agoMerge pull request #3062 from tosanjay/7zip-file-new-utf16name-leak
Dustin L. Howett [Sun, 24 May 2026 17:43:52 +0000 (12:43 -0500)] 
Merge pull request #3062 from tosanjay/7zip-file-new-utf16name-leak

7zip writer: free file->utf16name on symlink UTF-8 conversion failure

12 days agoMerge pull request #3057 from i1011/mtree-null-deref-fix
Dustin L. Howett [Sun, 24 May 2026 17:43:25 +0000 (12:43 -0500)] 
Merge pull request #3057 from i1011/mtree-null-deref-fix

mtree: Fix null dereference for some corner cases:

- a symlink whose target is never set
- emitting a root directory entry that is actually a file

12 days agoMerge pull request #3071 from stoeckmann/rar5_doublefree
Dustin L. Howett [Sun, 24 May 2026 17:43:00 +0000 (12:43 -0500)] 
Merge pull request #3071 from stoeckmann/rar5_doublefree

rar5: Avoid dangling pointers in init_unpack

12 days agoMerge pull request #3064 from i1011/version-details-fix
Dustin L. Howett [Sun, 24 May 2026 17:39:08 +0000 (12:39 -0500)] 
Merge pull request #3064 from i1011/version-details-fix

Fix libattr version returned in archive_version_details, as well as a leak.

12 days agorar5: Avoid dangling pointers in init_unpack 3071/head
Tobias Stoeckmann [Sun, 24 May 2026 13:06:06 +0000 (15:06 +0200)] 
rar5: Avoid dangling pointers in init_unpack

If init_unpack fails to allocate memory for given window size, a
dangling pointer can lead to an eventual double free.

Resolves #3069.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
12 days agomtree: Root entry '.' must be directory 3057/head
i1011 [Wed, 20 May 2026 16:44:39 +0000 (00:44 +0800)] 
mtree: Root entry '.' must be directory

12 days agomtree: Assign empty path to symlink if undefined
i1011 [Wed, 20 May 2026 16:43:36 +0000 (00:43 +0800)] 
mtree: Assign empty path to symlink if undefined

12 days agoAdd two testcases for mtree null deref
i1011 [Sun, 24 May 2026 11:41:16 +0000 (19:41 +0800)] 
Add two testcases for mtree null deref