]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
10 hours agoMerge pull request #3157 from libarchive/dependabot/github_actions/all-actions-0a5d8bb8fa master
Martin Matuška [Wed, 17 Jun 2026 09:30:05 +0000 (11:30 +0200)] 
Merge pull request #3157 from libarchive/dependabot/github_actions/all-actions-0a5d8bb8fa

CI: Bump the all-actions group across 1 directory with 5 updates

12 hours agoMerge pull request #3150 from DHowett/ci/windows-package-dependencies
Martin Matuška [Wed, 17 Jun 2026 07:29:46 +0000 (09:29 +0200)] 
Merge pull request #3150 from DHowett/ci/windows-package-dependencies

build: windows: get all CI dependencies from a package manager

13 hours agoCI: Bump the all-actions group across 1 directory with 5 updates 3157/head
dependabot[bot] [Wed, 17 Jun 2026 07:25:32 +0000 (07:25 +0000)] 
CI: Bump the all-actions group across 1 directory with 5 updates

Bumps the all-actions group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [acj/freebsd-firecracker-action](https://github.com/acj/freebsd-firecracker-action) | `0.9.1` | `0.10.0` |
| [actions/checkout](https://github.com/actions/checkout) | `6.0.1` | `6.0.3` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `6.0.0` | `7.0.1` |
| [cygwin/cygwin-install-action](https://github.com/cygwin/cygwin-install-action) | `6.0.1` | `6.0.2` |
| [github/codeql-action](https://github.com/github/codeql-action) | `4.31.9` | `4.36.2` |

Updates `acj/freebsd-firecracker-action` from 0.9.1 to 0.10.0
- [Release notes](https://github.com/acj/freebsd-firecracker-action/releases)
- [Commits](https://github.com/acj/freebsd-firecracker-action/compare/bab3e77871573c7943b80816f1641b6c1ce36896...ff79eb955fd19c697a708a02834995e47a6e58ed)

Updates `actions/checkout` from 6.0.1 to 6.0.3
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/8e8c483db84b4bee98b60c0593521ed34d9990e8...df4cb1c069e1874edd31b4311f1884172cec0e10)

Updates `actions/upload-artifact` from 6.0.0 to 7.0.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/b7c566a772e6b6bfb58ed0dc250532a479d7789f...043fb46d1a93c77aae656e7c1c64a875d1fc6a0a)

Updates `cygwin/cygwin-install-action` from 6.0.1 to 6.0.2
- [Release notes](https://github.com/cygwin/cygwin-install-action/releases)
- [Commits](https://github.com/cygwin/cygwin-install-action/compare/711d29f3da23c9f4a1798e369a6f01198c13b11a...3f0a3f9f988f7e96b8c18098ae05eaec175f5b52)

Updates `github/codeql-action` from 4.31.9 to 4.36.2
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/5d4e8d1aca955e8d8589aabd499c5cae939e33c7...8aad20d150bbac5944a9f9d289da16a4b0d87c1e)

---
updated-dependencies:
- dependency-name: acj/freebsd-firecracker-action
  dependency-version: 0.10.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: actions/checkout
  dependency-version: 6.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: all-actions
- dependency-name: cygwin/cygwin-install-action
  dependency-version: 6.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: github/codeql-action
  dependency-version: 4.36.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
13 hours agoMerge pull request #3144 from stoeckmann/cab_truncation
Martin Matuška [Wed, 17 Jun 2026 06:49:31 +0000 (08:49 +0200)] 
Merge pull request #3144 from stoeckmann/cab_truncation

cab: Improve truncation detection

13 hours agoMerge pull request #3134 from stoeckmann/archive_integer
Martin Matuška [Wed, 17 Jun 2026 06:48:55 +0000 (08:48 +0200)] 
Merge pull request #3134 from stoeckmann/archive_integer

Introduce `archive_integer.h` for checked arithmetic

13 hours agoMerge pull request #3145 from stoeckmann/cab_max_namelen
Tobias Stoeckmann [Wed, 17 Jun 2026 06:32:03 +0000 (08:32 +0200)] 
Merge pull request #3145 from stoeckmann/cab_max_namelen

cab: Properly limit maximum name length

17 hours agoMerge pull request #3153 from stoeckmann/cab_multi
Dustin L. Howett [Wed, 17 Jun 2026 02:57:14 +0000 (21:57 -0500)] 
Merge pull request #3153 from stoeckmann/cab_multi

cab: Fix multi volume parser

23 hours agocab: Fix name reading 3153/head
Tobias Stoeckmann [Tue, 16 Jun 2026 19:40:48 +0000 (21:40 +0200)] 
cab: Fix name reading

Archives are not necessarily 256 bytes long, e.g. the last part of a
multi volume archive. Only try to read up to 256 bytes when looking for
an archive or disk name, not necessarily exactly 256 bytes. This matches
the behavior of regular entry name lookups.

Also, disk names can be empty. Handle this as well.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
24 hours agocab: Add test for multi volume archives
Tobias Stoeckmann [Tue, 16 Jun 2026 19:37:55 +0000 (21:37 +0200)] 
cab: Add test for multi volume archives

The cab reader does not support multi volume archives, but it should be
able to read the files to print information about content.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
43 hours agoMerge pull request #3142 from datauwu/tar-avoid-wcs-slash-check
Dustin L. Howett [Tue, 16 Jun 2026 01:00:23 +0000 (20:00 -0500)] 
Merge pull request #3142 from datauwu/tar-avoid-wcs-slash-check

tar: avoid wide pathname conversion for trailing slash check

2 days agobuild: use vcpkg for Windows-MSVC's dependencies 3150/head
Dustin L. Howett [Sun, 7 Jul 2024 23:59:07 +0000 (18:59 -0500)] 
build: use vcpkg for Windows-MSVC's dependencies

2 days agobuild: move library dependencies into mingw install
Dustin L. Howett [Sun, 14 Jun 2026 15:22:41 +0000 (10:22 -0500)] 
build: move library dependencies into mingw install

2 days agobuild: use the setup-msys2 action rather than chocolatey
Dustin L. Howett [Mon, 1 Jun 2026 14:32:15 +0000 (10:32 -0400)] 
build: use the setup-msys2 action rather than chocolatey

This will give us some ability in the future to vary `MSYSTEM` and
produce different MSYS builds.

2 days agoMerge pull request #3148 from XananasX7/ci/pin-actions
Dustin L. Howett [Mon, 15 Jun 2026 20:25:35 +0000 (15:25 -0500)] 
Merge pull request #3148 from XananasX7/ci/pin-actions

ci: pin acj/freebsd-firecracker-action to full commit SHA

2 days agoMerge pull request #3149 from DHowett/fix-mingw-tests
Dustin L. Howett [Mon, 15 Jun 2026 20:24:06 +0000 (15:24 -0500)] 
Merge pull request #3149 from DHowett/fix-mingw-tests

2 days agotar: use filesystem-neutral replacement characters in the -s test 3149/head
Dustin L. Howett [Sun, 14 Jun 2026 20:01:29 +0000 (15:01 -0500)] 
tar: use filesystem-neutral replacement characters in the -s test

2 days agotest: promote the win32-repairing systemf wrapper to all systemf calls
Dustin L. Howett [Sun, 14 Jun 2026 20:01:00 +0000 (15:01 -0500)] 
test: promote the win32-repairing systemf wrapper to all systemf calls

3 days agoci: pin acj/freebsd-firecracker-action to full commit SHA 3148/head
XananasX7 [Sun, 14 Jun 2026 18:38:24 +0000 (18:38 +0000)] 
ci: pin acj/freebsd-firecracker-action to full commit SHA

  acj/freebsd-firecracker-action: @v0.9.1 -> @bab3e77871573c7943b80816f1641b6c1ce36896

3 days agoMerge pull request #3143 from stoeckmann/7zip_size_int64
Dustin L. Howett [Sun, 14 Jun 2026 15:01:50 +0000 (10:01 -0500)] 
Merge pull request #3143 from stoeckmann/7zip_size_int64

7zip: Avoid unnecessary int64_t size_t casts

3 days agoMerge pull request #3146 from stoeckmann/size_t_off
Dustin L. Howett [Sun, 14 Jun 2026 14:59:01 +0000 (09:59 -0500)] 
Merge pull request #3146 from stoeckmann/size_t_off

read_disk: Check if off_t can overflow size_t

3 days agoread_disk: Check if off_t can overflow size_t 3146/head
Tobias Stoeckmann [Sun, 14 Jun 2026 09:14:03 +0000 (11:14 +0200)] 
read_disk: Check if off_t can overflow size_t

Make sure that the content of the link can fit into a size_t. This
should be always true, but be cautious with 32 bit systems and very
weird filesystems (possibly through fuse).

I took SSIZE_MAX as upper limit due to signedness and eventual readlink
calls which would fail with larger values anyway.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days ago7zip: Avoid unnecessary int64_t size_t casts 3143/head
Tobias Stoeckmann [Sat, 13 Jun 2026 09:01:42 +0000 (11:01 +0200)] 
7zip: Avoid unnecessary int64_t size_t casts

Use size_t for avail_in, avail_out and stream_in for ppmd streams.

The fields avail_in and avail_out values are set in function decompress
based on size_t variables (t_avail_in/t_avail_out) and eventually
written back. The stream_in field is only incremented.

The actual use case happens within ppmd_read to support situations in
which not enough bytes are available. In such cases, more bytes are read
on demand but not written into next_in.

In such cases, avail_in can turn negative and next_in can point outside
of its allocated memory area.

Since stream_in is always incremented by one, it won't overflow on real
hardware, given that size_t would address the whole available heap
space.

Make sure that avail_in never turns negative (which allows the size_t
usage) and also guarantee that t_avail_in will never wrap around,
leading to a huge "used" value.

As a bonus, __archive_read_ahead can be reliably called with a NULL
argument now, since no more casting occurs for second argument, which
was missing in the test.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agocab: Properly limit maximum name length 3145/head
Tobias Stoeckmann [Sat, 13 Jun 2026 14:08:10 +0000 (16:08 +0200)] 
cab: Properly limit maximum name length

The cab_read_ahead_remaining function might return more bytes through
avail than initially asked for. The given limit is 255+1, i.e. the
maximum file name length.

While it's not a big deal for libarchive to handle file names longer
than that, the CAB format does not allow longer names.

Limit the amount of available bytes to the given argument for proper
checking.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agocab: Improve truncation detection 3144/head
Tobias Stoeckmann [Sat, 13 Jun 2026 14:02:38 +0000 (16:02 +0200)] 
cab: Improve truncation detection

If not enough bytes are available, __archive_read_ahead will return the
amount of bytes still available, which can be larger than 0. Only in
error cases, a negative value is returned.

Check the return pointer instead. It simplifies the error handling,
allows a NULL argument, and covers more truncation issues.

Right now, a NULL pointer with a non-zero size could be further
processed, which just asks for more technical or logical issues to
arise.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agotar: avoid wide pathname conversion for trailing slash check 3142/head
data [Sat, 13 Jun 2026 00:12:52 +0000 (08:12 +0800)] 
tar: avoid wide pathname conversion for trailing slash check

Avoid requesting the wide-character pathname when the tar reader only
needs to check whether a regular entry name ends in '/'.

archive_entry_pathname_w() can lazily convert the pathname to WCS. In the
common tar read path, the multibyte pathname is already available, so
checking it first avoids unnecessary per-entry conversion. The WCS fallback
is kept for cases where the multibyte pathname is unavailable.

4 days agotime: Use archive_integer.h 3134/head
Tobias Stoeckmann [Wed, 10 Jun 2026 18:09:24 +0000 (20:09 +0200)] 
time: Use archive_integer.h

Use archive_integer's checked integer arithmetic.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agotime: Sort header includes
Tobias Stoeckmann [Wed, 10 Jun 2026 18:08:33 +0000 (20:08 +0200)] 
time: Sort header includes

While at it, add header checks.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agoUse archive_integer.h for number parsers
Tobias Stoeckmann [Wed, 10 Jun 2026 18:06:40 +0000 (20:06 +0200)] 
Use archive_integer.h for number parsers

Use checked integer arithmetic to detect integer overflows.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 days agoAdd archive_integer.h
Tobias Stoeckmann [Wed, 10 Jun 2026 17:56:40 +0000 (19:56 +0200)] 
Add archive_integer.h

The archive_integer.h header offers various integer operations to
libarchive, utilizing system functionality where possible.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 days agoMerge pull request #3138 from datauwu/tar-ustar-pathname-fastpath
Dustin L. Howett [Fri, 12 Jun 2026 18:17:58 +0000 (13:17 -0500)] 
Merge pull request #3138 from datauwu/tar-ustar-pathname-fastpath

5 days agoMerge pull request #3140 from DHowett/dh/write-free-1
Tobias Stoeckmann [Fri, 12 Jun 2026 16:05:13 +0000 (18:05 +0200)] 
Merge pull request #3140 from DHowett/dh/write-free-1

test: remove one new instance of assertEqualIntA(...free...)

5 days agotest: remove one new instance of assertEqualIntA(...free...) 3140/head
Dustin L. Howett [Fri, 12 Jun 2026 15:30:13 +0000 (10:30 -0500)] 
test: remove one new instance of assertEqualIntA(...free...)

5 days agoMerge pull request #2865 from GeorgH93/read_zipx_encryption
Dustin L. Howett [Fri, 12 Jun 2026 15:28:45 +0000 (10:28 -0500)] 
Merge pull request #2865 from GeorgH93/read_zipx_encryption

Add support for reading encrypted zipx formats (bzip2, lzma, ppmd, xz, zstd)

5 days agoIntroduce zipx encryption handling for zstd compressed zip files 2865/head
GeorgH93 [Wed, 10 Jun 2026 19:35:48 +0000 (21:35 +0200)] 
Introduce zipx encryption handling for zstd compressed zip files

5 days agoIntroduce zipx encryption handling for bzip2 compressed zip files
GeorgH93 [Wed, 10 Jun 2026 19:35:20 +0000 (21:35 +0200)] 
Introduce zipx encryption handling for bzip2 compressed zip files

5 days agoIntroduce zipx encryption handling for lzma compressed zip files
GeorgH93 [Wed, 10 Jun 2026 19:34:27 +0000 (21:34 +0200)] 
Introduce zipx encryption handling for lzma compressed zip files

5 days agoIntroduce zipx encryption handling for xz compressed zip files
GeorgH93 [Wed, 10 Jun 2026 19:33:16 +0000 (21:33 +0200)] 
Introduce zipx encryption handling for xz compressed zip files

5 days agoIntroduce zipx encryption handling for ppmd compressed zip files
GeorgH93 [Wed, 10 Jun 2026 19:31:46 +0000 (21:31 +0200)] 
Introduce zipx encryption handling for ppmd compressed zip files

5 days agoAdd test for creating encrypted zip file with libarchive and reading it again with...
GeorgH93 [Wed, 10 Jun 2026 19:27:29 +0000 (21:27 +0200)] 
Add test for creating encrypted zip file with libarchive and reading it again with libarchive

5 days agoRefactor zip archive reader, by moving decryption related code blocks into their...
GeorgH93 [Wed, 10 Jun 2026 19:23:31 +0000 (21:23 +0200)] 
Refactor zip archive reader, by moving decryption related code blocks into their own functions to make them reusable for compression formats other than deflate

5 days agotar reader: avoid temporary buffer for empty-prefix ustar names 3138/head
data [Thu, 11 Jun 2026 19:36:33 +0000 (03:36 +0800)] 
tar reader: avoid temporary buffer for empty-prefix ustar names

For empty-prefix ustar entries, copy the fixed-width name field
directly into the archive entry instead of first building a temporary
archive_string.

This avoids a temporary buffer allocation and intermediate copy in the
common case. It also fixes a small fatal-error leak by freeing the
temporary prefix/name buffer before returning on pathname conversion
failure.

5 days agoMerge pull request #2923 from bililateral/pr-7zip-numfiles-oom
Tobias Stoeckmann [Fri, 12 Jun 2026 06:27:25 +0000 (08:27 +0200)] 
Merge pull request #2923 from bililateral/pr-7zip-numfiles-oom

7zip: sanity-check FilesInfo NumFiles before allocating entries

5 days agoMerge pull request #3105 from i1011/rar-unbounded-staticdata-fix
Dustin L. Howett [Fri, 12 Jun 2026 04:09:19 +0000 (23:09 -0500)] 
Merge pull request #3105 from i1011/rar-unbounded-staticdata-fix

rar: Add missing bound check for staticdata

5 days agoMerge pull request #3137 from stoeckmann/typos_style
Dustin L. Howett [Fri, 12 Jun 2026 04:05:03 +0000 (23:05 -0500)] 
Merge pull request #3137 from stoeckmann/typos_style

Fix minor non-functional issues

5 days agoMerge pull request #3136 from stoeckmann/counters
Dustin L. Howett [Thu, 11 Jun 2026 20:41:05 +0000 (15:41 -0500)] 
Merge pull request #3136 from stoeckmann/counters

Remove unneeded counters

6 days agocpio: Remove unneeded cast 3137/head
Tobias Stoeckmann [Thu, 11 Jun 2026 16:59:29 +0000 (18:59 +0200)] 
cpio: Remove unneeded cast

The variable l is uint64_t, the return type is uint64_t. Do not cast to
int64_t.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 days agoFix whitespace issues
Tobias Stoeckmann [Thu, 11 Jun 2026 16:59:18 +0000 (18:59 +0200)] 
Fix whitespace issues

No functional change

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 days agoFix typos in comments and documentation
Tobias Stoeckmann [Thu, 11 Jun 2026 16:58:19 +0000 (18:58 +0200)] 
Fix typos in comments and documentation

No functional change

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 days agofilters: Remove unneeded counters 3136/head
Tobias Stoeckmann [Thu, 11 Jun 2026 16:57:36 +0000 (18:57 +0200)] 
filters: Remove unneeded counters

These counters are written to, but they are never read. Remove them for
easier code audits.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 days agoformats: Remove unneeded counters
Tobias Stoeckmann [Thu, 11 Jun 2026 16:56:59 +0000 (18:56 +0200)] 
formats: Remove unneeded counters

These counters are written to, but they are never read. Remove them for
easier code audits.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
6 days agorar: Reject staticdatalen larger than VM memory 3105/head
i1011 [Thu, 11 Jun 2026 16:51:16 +0000 (00:51 +0800)] 
rar: Reject staticdatalen larger than VM memory

6 days agoMerge commit from fork
Tobias Stoeckmann [Thu, 11 Jun 2026 15:41:31 +0000 (17:41 +0200)] 
Merge commit from fork

unzip: reject absolute or traversing symlink targets

7 days agoRefactor the zip_winzip_aes_large test to support parameterized file ordering, file...
GeorgH93 [Wed, 10 Jun 2026 19:14:02 +0000 (21:14 +0200)] 
Refactor the zip_winzip_aes_large test to support parameterized file ordering, file mode and compression type

7 days ago7zip: sanity-check FilesInfo NumFiles before allocating entries 2923/head
bililateral [Wed, 18 Mar 2026 08:37:45 +0000 (16:37 +0800)] 
7zip: sanity-check FilesInfo NumFiles before allocating entries

7 days agoMerge pull request #3048 from legnaleurc/fix/rar-reset-lz-table
Dustin L. Howett [Wed, 10 Jun 2026 01:30:47 +0000 (20:30 -0500)] 
Merge pull request #3048 from legnaleurc/fix/rar-reset-lz-table

rar: reset low-distance state for new LZ tables

7 days agoMerge pull request #3047 from legnaleurc/fix/rar-recovery-record
Dustin L. Howett [Wed, 10 Jun 2026 01:26:31 +0000 (20:26 -0500)] 
Merge pull request #3047 from legnaleurc/fix/rar-recovery-record

rar: skip NEWSUB payloads without size cap

7 days agoMerge pull request #3132 from stoeckmann/lz4_double_free
Dustin L. Howett [Wed, 10 Jun 2026 01:14:28 +0000 (20:14 -0500)] 
Merge pull request #3132 from stoeckmann/lz4_double_free

lz4: Fix double-free on reallocation failure
Alternative version of https://github.com/libarchive/libarchive/pull/2945 which removes the test (which requires a modified malloc to actually fail the 4 MB allocation).

7 days agoMerge pull request #3034 from datauwu/master
Dustin L. Howett [Tue, 9 Jun 2026 22:00:55 +0000 (17:00 -0500)] 
Merge pull request #3034 from datauwu/master

7 days agoFix double-free in LZ4 filter on reallocation failure (CWE-415) 3132/head
isomorph-cyber [Wed, 25 Mar 2026 03:19:10 +0000 (23:19 -0400)] 
Fix double-free in LZ4 filter on reallocation failure (CWE-415)

lz4_allocate_out_block() frees state->out_block without NULLing
the pointer. If the subsequent malloc fails, the function returns
ARCHIVE_FATAL with a dangling pointer. lz4_filter_close() later
calls free(state->out_block) again, triggering a double-free.

Also, state->out_block_size was updated before checking if malloc
succeeded, leaving inconsistent metadata on failure.

Fix both lz4_allocate_out_block() and lz4_allocate_out_block_for_legacy():
- NULL the pointer immediately after free
- Move size update to after malloc succeeds
- Reset size to 0 on allocation failure

7 days ago7zip: reject malformed SubStreamsInfo metadata 3034/head
datauwu [Tue, 9 Jun 2026 19:10:27 +0000 (03:10 +0800)] 
7zip: reject malformed SubStreamsInfo metadata

Validate the accumulated unpack stream count before allocating
per-substream metadata.

Reject folders that declare multiple substreams without kSize metadata,
since the parser needs those sizes to describe the stream layout.

Drop the explicit digest zeroing loop. The arrays are allocated with
calloc(), so the entries are already initialized.

8 days ago7zip: add malformed SubStreamsInfo test
datauwu [Tue, 9 Jun 2026 19:10:27 +0000 (03:10 +0800)] 
7zip: add malformed SubStreamsInfo test

Add a 7z regression test for malformed SubStreamsInfo metadata that
declares more than one unpack stream without the kSize data needed to
describe those streams.

Store the archive as a .7z.uu file, matching the existing malformed
7z tests.

8 days agounzip: reject absolute or traversing symlink targets
Dustin L. Howett [Tue, 9 Jun 2026 16:16:02 +0000 (11:16 -0500)] 
unzip: reject absolute or traversing symlink targets

This is overly broad, and will reject some well-formed archives which
contain symlinks to trees which exist in the archive; however, this is
the best we can do without some rudimentary path parsing.

Fixes GHSA-q4gj-vh8c-67p8

8 days agoMerge pull request #2954 from ShelpAm/master
Dustin L. Howett [Tue, 9 Jun 2026 14:55:46 +0000 (09:55 -0500)] 
Merge pull request #2954 from ShelpAm/master

fix: zstd not found on Windows

8 days agoMerge pull request #2967 from bgilbert/deflate
Martin Matuška [Tue, 9 Jun 2026 06:40:07 +0000 (08:40 +0200)] 
Merge pull request #2967 from bgilbert/deflate

Fix `test_write_filter_gzip` on Ubuntu s390x

8 days agoMerge pull request #3131 from stoeckmann/rpm_fsm
Martin Matuška [Tue, 9 Jun 2026 06:35:23 +0000 (08:35 +0200)] 
Merge pull request #3131 from stoeckmann/rpm_fsm

rpm: Refactor filter

8 days agoMerge pull request #3128 from stoeckmann/into_fd
Martin Matuška [Tue, 9 Jun 2026 06:31:24 +0000 (08:31 +0200)] 
Merge pull request #3128 from stoeckmann/into_fd

Improve `archive_read_data_into_fd` with sparse files

8 days agoMerge pull request #3121 from stoeckmann/rar5_bytes_remaining
Martin Matuška [Tue, 9 Jun 2026 06:30:03 +0000 (08:30 +0200)] 
Merge pull request #3121 from stoeckmann/rar5_bytes_remaining

rar5: fix signed integer underflow in bytes_remaining

8 days agoMerge pull request #3120 from stoeckmann/archive_endian
Martin Matuška [Tue, 9 Jun 2026 06:29:23 +0000 (08:29 +0200)] 
Merge pull request #3120 from stoeckmann/archive_endian

Extend `archive_endian.h` usage

8 days agoMerge pull request #3098 from stoeckmann/filter_read_ahead
Martin Matuška [Tue, 9 Jun 2026 06:28:38 +0000 (08:28 +0200)] 
Merge pull request #3098 from stoeckmann/filter_read_ahead

filters: Simplify `__archive_read_filter_ahead` use

8 days agoMerge pull request #3119 from stoeckmann/7zip_u32_oflow
Martin Matuška [Tue, 9 Jun 2026 06:27:58 +0000 (08:27 +0200)] 
Merge pull request #3119 from stoeckmann/7zip_u32_oflow

7zip: Fix range check in get_pe_sfx_offset

8 days agoMerge pull request #3115 from stoeckmann/gzip_writer_mem
Martin Matuška [Tue, 9 Jun 2026 06:26:54 +0000 (08:26 +0200)] 
Merge pull request #3115 from stoeckmann/gzip_writer_mem

gzip: Fix OOB in writer with huge filename

8 days agoMerge pull request #3114 from stoeckmann/open_oob
Martin Matuška [Tue, 9 Jun 2026 06:25:51 +0000 (08:25 +0200)] 
Merge pull request #3114 from stoeckmann/open_oob

Fix OOB in `archive_read_open_filenames_w` on some systems

8 days agoMerge pull request #3113 from stoeckmann/fflags_strcpy
Martin Matuška [Tue, 9 Jun 2026 06:25:10 +0000 (08:25 +0200)] 
Merge pull request #3113 from stoeckmann/fflags_strcpy

7zip/rar5: Simplify file attribute handling

8 days agoMerge pull request #3108 from stoeckmann/windows_legacy
Martin Matuška [Tue, 9 Jun 2026 06:24:24 +0000 (08:24 +0200)] 
Merge pull request #3108 from stoeckmann/windows_legacy

Reduce Windows legacy support

8 days agoMerge pull request #3116 from stoeckmann/hardening
Dustin L. Howett [Tue, 9 Jun 2026 00:29:04 +0000 (19:29 -0500)] 
Merge pull request #3116 from stoeckmann/hardening

This PR does not fix any reachable issue, but fixes the code in question nonetheless to prevent regressions in the future:

- Do not call `archive_copy_error` after `archive_read_free` to prevent a user after free bug
- Reset `vtable` to `NULL` to prevent `close` from being called after filter initialization error, since `data` is already freed and set to `NULL`, preventing a `NULL` pointer dereference

8 days agoMerge pull request #3021 from chnzzh/fix/iso9660-ce-loop
Dustin L. Howett [Tue, 9 Jun 2026 00:06:43 +0000 (19:06 -0500)] 
Merge pull request #3021 from chnzzh/fix/iso9660-ce-loop

iso9660: fix infinite loop on self-referencing CE entry

8 days agoMerge pull request #3127 from shxz9u/fix-callback-data-realloc
Dustin L. Howett [Mon, 8 Jun 2026 20:39:07 +0000 (15:39 -0500)] 
Merge pull request #3127 from shxz9u/fix-callback-data-realloc

Avoid updating allocation state before realloc succeeds

8 days agoMerge pull request #3126 from stoeckmann/shar
Dustin L. Howett [Mon, 8 Jun 2026 20:30:26 +0000 (15:30 -0500)] 
Merge pull request #3126 from stoeckmann/shar

shar: Check `archive_entry_clone` result

8 days agoMerge pull request #3125 from stoeckmann/disk_clone
Dustin L. Howett [Mon, 8 Jun 2026 20:29:48 +0000 (15:29 -0500)] 
Merge pull request #3125 from stoeckmann/disk_clone

Check allocation in `_archive_write_disk_header`

9 days agoMerge pull request #3124 from stoeckmann/entry_mem
Dustin L. Howett [Mon, 8 Jun 2026 20:28:01 +0000 (15:28 -0500)] 
Merge pull request #3124 from stoeckmann/entry_mem

entry_link_resolver: Improve memory handling

9 days agoMerge pull request #3123 from stoeckmann/cab_remaining
Dustin L. Howett [Mon, 8 Jun 2026 20:27:04 +0000 (15:27 -0500)] 
Merge pull request #3123 from stoeckmann/cab_remaining

cab: Simplify `cab_read_ahead_remaining`

9 days agoMerge pull request #3122 from stoeckmann/into_buffer
Dustin L. Howett [Mon, 8 Jun 2026 20:26:25 +0000 (15:26 -0500)] 
Merge pull request #3122 from stoeckmann/into_buffer

Remove `archive_read_data_into_buffer` comment

9 days agoMerge pull request #3117 from i1011/iso9660-null-deref-fix
Dustin L. Howett [Mon, 8 Jun 2026 20:25:59 +0000 (15:25 -0500)] 
Merge pull request #3117 from i1011/iso9660-null-deref-fix

iso9660: Fix null dereference in set_directory_record_rr

9 days agoopen: Fix OOB in archive_read_open_filenames_w 3114/head
Tobias Stoeckmann [Wed, 3 Jun 2026 20:12:03 +0000 (22:12 +0200)] 
open: Fix OOB in archive_read_open_filenames_w

If a system with sizeof(wchar_t)=2 (e.g. Cygwin) tries to convert a wide
character string into a multi byte string representation, it
precalculates the required length with sizeof(wchar_t) instead of
MB_LEN_MAX. This can lead to short memory allocation for filenames which
have a shorter representation in wchar_t than in UTF-8.

Resolves GHSA-crm5-q56g-xw29.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
9 days agoopen: Check OOB in archive_read_open_filenames_w
Tobias Stoeckmann [Wed, 3 Jun 2026 20:10:35 +0000 (22:10 +0200)] 
open: Check OOB in archive_read_open_filenames_w

A system with sizeof(wchar_t)=2 (Cygwin on Windows) can trigger an out
of boundary write in archive_read_open_filenames_w when converting the
wide character string into a multi byte string.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
9 days agorpm: Refactor filter 3131/head
Tobias Stoeckmann [Mon, 8 Jun 2026 18:39:39 +0000 (20:39 +0200)] 
rpm: Refactor filter

The current finite state machine carefully handles short reads, i.e. the
loop can enter as often as needed until enough bytes arrive for the
current state to perform its actions.

This can be simplified by relying on __archive_filter_read_ahead to
return the amount of bytes actually needed. I assume that this did not
happen in the original code due to its age (2009) and evolution of
libarchive's internals over time.

Also, headers are only skipped at the beginning. As soon as the reader
starts returning data (ST_ARCHIVE reached), the filter pretty much
becomes a pass-through filter.

Split the initial lead and header skipping into its own function and
only keep track if the initial skipping was performed or not. This
greatly simplifies the reader function.

Also, it avoids book keeping of internal states and "total_in" tracking,
which I don't have to properly audit for edge cases anymore.

Last but not least, this refactoring properly reports truncated streams
now.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
9 days agoAvoid updating allocation state before realloc succeeds 3127/head
magnolia [Sun, 7 Jun 2026 23:37:54 +0000 (08:37 +0900)] 
Avoid updating allocation state before realloc succeeds

10 days agoread_data_into_fd: Allocate nulls on demand 3128/head
Tobias Stoeckmann [Sun, 7 Jun 2026 15:20:58 +0000 (17:20 +0200)] 
read_data_into_fd: Allocate nulls on demand

Allocate nulls only when needed, i.e. when sparse files are encountered.
This removes another malloc call from regular use cases.

While at it, call archive_set_error in case of allocation failure for
better error messages.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agoread_data_into_fd: Perform final seek check
Tobias Stoeckmann [Sun, 7 Jun 2026 14:47:20 +0000 (16:47 +0200)] 
read_data_into_fd: Perform final seek check

Try to detect if writing data to correct position failed due to being
in append mode.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agoread_data_into_fd: Print correct error code
Tobias Stoeckmann [Sun, 7 Jun 2026 14:44:36 +0000 (16:44 +0200)] 
read_data_into_fd: Print correct error code

If lseek fails to seek to correct position, e.g. because the descriptor
is in append mode, do not use errno because it's not set.

In such a case, fall back to ARCHIVE_ERRNO_MISC.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agoshar: Check archive_entry_clone result 3126/head
Tobias Stoeckmann [Sun, 7 Jun 2026 13:52:45 +0000 (15:52 +0200)] 
shar: Check archive_entry_clone result

Properly handle allocation failures.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agoCheck allocation in _archive_write_disk_header 3125/head
Tobias Stoeckmann [Sun, 7 Jun 2026 13:49:46 +0000 (15:49 +0200)] 
Check allocation in _archive_write_disk_header

The POSIX and Windows code did not check the result of
archive_entry_clone. Handle this error condition properly.

While at it, unify POSIX and Windows code a bit.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agoentry: Use size_t for element count 3124/head
Tobias Stoeckmann [Sun, 7 Jun 2026 13:43:13 +0000 (15:43 +0200)] 
entry: Use size_t for element count

LLP64 could theoretically overflow the 32 bit counter. It still needs a
lot memory to achieve this, but let's better be safe than sorry.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agoentry: Check allocation in insert_entry
Tobias Stoeckmann [Sun, 7 Jun 2026 13:42:29 +0000 (15:42 +0200)] 
entry: Check allocation in insert_entry

Check if allocation succeded. If not, properly handle the error instead
of eventually performing a NULL pointer dereference.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agocab: Simplify cab_read_ahead_remaining 3123/head
Tobias Stoeckmann [Sun, 7 Jun 2026 13:19:50 +0000 (15:19 +0200)] 
cab: Simplify cab_read_ahead_remaining

We do not have to guess the amount of remaining bytes, since
archive_read_ahead returns the information.

Simplify the function.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agoRemove archive_read_data_into_buffer comment 3122/head
Tobias Stoeckmann [Sun, 7 Jun 2026 13:15:33 +0000 (15:15 +0200)] 
Remove archive_read_data_into_buffer comment

The function has been removed in 2011 with commit
fe9b86254d66411b6bf267a02236d4672258b61b. Remove the comment as well.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agorar5: fix integer underflow in bytes_remaining 3121/head
00redbeer [Sun, 7 Jun 2026 12:23:25 +0000 (14:23 +0200)] 
rar5: fix integer underflow in bytes_remaining

A malformed RAR5 archive with data_size=1 forces bytes_remaining
(ssize_t) to wrap to -2 when a compressed block header consumes
to_skip=3 bytes (CWE-191). That negative value is then implicitly
cast to size_t ~0 inside malloc(), requesting a ~16-exabyte
allocation — confirmed heap buffer overflow via ASAN/UBSan on a
48-byte crafted archive requiring no authentication.

Three guards added to archive_read_support_format_rar5.c:

1. Reject data_size > SSIZE_MAX before assigning to bytes_remaining
   (CWE-195, unsafe unsigned-to-signed conversion)

2. Reject to_skip > bytes_remaining in process_block() before the
   subtraction — this is the primary fix for the underflow (CWE-191)

3. Change cur_block_size == 0 to cur_block_size <= 0 in merge_block()
   as defense-in-depth so that any negative bytes_remaining reaching
   read_ahead() is caught before it becomes a malloc size (CWE-122)

10 days agorar5: check integer overflow in bytes_remaining
00redbeer [Sun, 7 Jun 2026 12:14:34 +0000 (14:14 +0200)] 
rar5: check integer overflow in bytes_remaining

A malformed RAR5 archive with data_size=1 forces bytes_remaining
(ssize_t) to wrap to -2 when a compressed block header consumes
to_skip=3 bytes (CWE-191). That negative value is then implicitly
cast to size_t ~0 inside malloc(), requesting a ~16-exabyte
allocation — confirmed heap buffer overflow via ASAN/UBSan on a
48-byte crafted archive requiring no authentication.

Reproducer: 48-byte crafted RAR5 archive; ASAN confirms
"allocation-size-too-big 0xfffffffffffffffe".

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
10 days agoiso9660: Reserve more space in record to avoid null deref 3117/head
i1011 [Sun, 7 Jun 2026 12:50:42 +0000 (20:50 +0800)] 
iso9660: Reserve more space in record to avoid null deref

10 days agoiso9660: Add symlink name length enumeration test
i1011 [Sun, 7 Jun 2026 12:50:31 +0000 (20:50 +0800)] 
iso9660: Add symlink name length enumeration test