Commit Graph
8083 Commits
Author SHA1 Message Date
Tobias Stoeckmann d42b4c1999 format: Forward errors/warnings in support_format
If registering a format parser bidder fails or triggers a warning,
forward the information instead of silently turning it into ARCHIVE_OK.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2026-08-03 19:57:25 +02:00
Tobias Stoeckmann a2b7dea95f format: Test error handling in support_format
Make sure that all formats return a warning if registered multiple
times.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2026-08-03 19:57:25 +02:00
Dustin L. Howett ada220177a Merge pull request #3347 from datauwu/archive-write-share-hdrcharset
archive_write: share hdrcharset option handling
2026-08-03 12:51:31 -05:00
Dustin L. Howett d83294359b Merge pull request #3346 from stoeckmann/append_filter_desync
Always attach filter to correct bidder
2026-08-03 12:48:35 -05:00
Dustin L. Howett 2d91e3a051 Merge pull request #3350 from libarchive/dependabot/github_actions/all-actions-4f142db38a
CI: Bump the all-actions group with 4 updates
2026-08-03 12:07:32 -05:00
dependabot[bot] b3d621f4c3 CI: Bump the all-actions group with 4 updates
Bumps the all-actions group with 4 updates: [github/codeql-action/init](https://github.com/github/codeql-action), [github/codeql-action/autobuild](https://github.com/github/codeql-action), [github/codeql-action/analyze](https://github.com/github/codeql-action) and [github/codeql-action/upload-sarif](https://github.com/github/codeql-action).


Updates `github/codeql-action/init` from 4.37.3 to 4.37.4
- [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/e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81...f205ea1c3313d32999d8d6a48b4f6530d4437b38)

Updates `github/codeql-action/autobuild` from 4.37.3 to 4.37.4
- [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/e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81...f205ea1c3313d32999d8d6a48b4f6530d4437b38)

Updates `github/codeql-action/analyze` from 4.37.3 to 4.37.4
- [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/e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81...f205ea1c3313d32999d8d6a48b4f6530d4437b38)

Updates `github/codeql-action/upload-sarif` from 4.37.3 to 4.37.4
- [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/e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81...f205ea1c3313d32999d8d6a48b4f6530d4437b38)

---
updated-dependencies:
- dependency-name: github/codeql-action/init
  dependency-version: 4.37.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.37.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.37.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.37.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-03 16:18:20 +00:00
datauwu 86a88b9edf archive_write: share hdrcharset option handling
Several archive writers duplicate identical hdrcharset option handling.
Share the validation and conversion logic across the affected cpio, tar,
and zip writers.

This reduces duplication without changing behavior.
2026-08-03 16:53:58 +08:00
Dustin L. Howett c706ac4b56 Merge pull request #3312 from datauwu/formats-use-strrchr 2026-08-02 23:53:08 -05:00
Tim Kientzle 0c353e1a8f Merge pull request #3343 from dnelson-1901/tar-mode
tar: add --mode option for GNU tar compatibility
2026-08-02 07:34:39 -07:00
Tobias Stoeckmann 7c7d41c13c Remove bidder name
The name was only needed to find the appropriate bidder for a filter.
Since this has been resolved by accessing the last bidder, since in these
situations the bidder is added first, then the filter, the name is not
needed anymore.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2026-08-02 15:13:35 +02:00
Tobias Stoeckmann 50b585bb55 append_filter: Use last bidder for filter
Appending a filter implies appending a bidder. Always use the last added
bidder, since it was just added. This avoids desync situations where
previously added bidders could erroneously match.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2026-08-02 15:13:33 +02:00
Tobias Stoeckmann bf1f5ba79e append_filter: Verify that bidder and filter match
Make sure that appending a filter always matches its supposed bidder.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2026-08-02 15:12:59 +02:00
Dan Nelson c26faff361 tar: handle --mode when extracting archives also 2026-08-01 15:11:08 -05:00
Dan Nelson e8154e0bfc tar: add --mode option (compatible with gnutar) 2026-08-01 15:11:08 -05:00
Tim Kientzle e893064acf Merge pull request #3344 from datauwu/warc-fix-ub
warc: fix UB signed overflow in time conversion
2026-08-01 12:58:35 -07:00
datauwu c84de7963c warc: fix UB signed overflow in time conversion
Use checked 64-bit math when timegm() is not available.
Reject values outside time_t instead of overflowing signed integers.
2026-08-02 03:04:20 +08:00
datauwu 535360bfeb warc: test future date conversion
Add a WARC date after 2038 to cover the fallback time conversion.
On 64-bit time_t, it must parse as the expected Unix timestamp.
2026-08-02 02:57:01 +08:00
Tim Kientzle ea476d962f Merge pull request #3342 from datauwu/bsdcpio-fix-ub
bsdcpio: fix UB signed overflow in time formatting
2026-08-01 08:54:01 -07:00
datauwu 0da2e229b1 bsdtar: fix UB signed overflow in time formatting
Use difftime() instead of changing time_t values by the half-year
range. This avoids signed overflow near the time_t limits without
changing normal output.
2026-08-01 19:48:39 +08:00
datauwu efa19ce699 bsdcpio: fix UB signed overflow in time formatting
Use difftime() instead of subtracting time_t values when choosing the
date format. This avoids signed overflow for far past or future
timestamps without changing normal output.
2026-08-01 19:48:38 +08:00
Dustin L. Howett 8c4acda5e7 Merge pull request #3335 from jaipaulcheernam/fix/skip-ppmd8-aes256-test-without-crypto 2026-07-31 09:22:42 -05:00
Dustin L. Howett 280402b7f1 Merge pull request #3339 from datauwu/archive-string-fix-build 2026-07-30 18:21:32 -05:00
datauwu fcf3d40b3b archive_string: require localcharset.h for locale_charset
Only call locale_charset() when localcharset.h provides its declaration.
2026-07-30 16:20:51 +08:00
Jaipaul Cheernam c2b00a5fff test: skip ppmd8 aes256 streaming test when no crypto library is present
test_read_format_zip_ppmd8_aes256_streaming fails with 6 assertion
failures on systems without a crypto library (openssl/nettle/mbedtls)
because it tries to decrypt a pre-built encrypted zipx file without
checking crypto availability first.

Add the same guard used by the other encrypted zip tests in this file.

Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
2026-07-29 13:37:21 +00:00
Dustin L. Howett 19ff56da4f Merge pull request #3320 from carrerasdarren-cell/fix/iso9660-boot-image-size-overflow
iso9660: avoid boot image block count overflow
2026-07-28 14:32:46 -05:00
carrerasdarren-cell f648978feb iso9660: avoid boot image block count overflow
Use overflow-free ceiling division before narrowing the boot image block count to int.

Fixes #3269
2026-07-28 14:53:36 -04:00
Dustin L. Howett 40da2cdc52 Merge pull request #3315 from datauwu/iso9660-remove-per-reader-comp-buf
iso9660: remove per-reader zero comparison buffer
2026-07-27 17:12:53 -05:00
Dustin L. Howett 10ea0e7499 Merge pull request #3302 from datauwu/program-read-fix-uaf
program: fix dangling pointer after close
2026-07-27 17:12:20 -05:00
Dustin L. Howett e207c4b357 Merge pull request #3317 from stoeckmann/rar5_varint
rar5: Improve varint handling
2026-07-27 16:08:31 -05:00
Tim Kientzle 4c5854ed69 Merge pull request #3329 from dag-erling/des/xar-unsup-digest
xar: Fix for unsupported digests
2026-07-27 12:36:40 -07:00
Dustin L. Howett ca6e125867 Merge pull request #3325 from tbontb-iaq/fix/seek-data-null-not-fatal
archive_read: don't poison archive when format lacks seek_data (fixes #3323)
2026-07-27 14:24:12 -05:00
Dag-Erling Smørgrav 4acbc50d7d xar: Fix for unsupported digests
* In _checksum_init() and _checksum_final(), fail if the requested digest
  is not supported (e.g. archive uses SHA256 but libarchive was compiled
  without SHA256 support)

* In checksum_init(), fail with a meaningful error message if either
  _checksum_init() call fails.

* In checksum_final(), simplify the logic and improve the error message.

* Make the various digest tests conditional on support for the digest
  being tested.

Fixes:		6f10adcd59 ("xar: Add support for SHA256 and SHA512")
2026-07-27 21:02:23 +02:00
Dustin L. Howett 3e6d656c80 Merge pull request #3322 from datauwu/warc-writer-unify
warc: match other writer styles
2026-07-27 13:43:51 -05:00
Tim Kientzle b722e2cccc Merge pull request #3328 from dag-erling/des/xar-sha2
xar: Add support for SHA256 and SHA512
2026-07-27 11:20:21 -07:00
Dag-Erling Smørgrav 6f10adcd59 xar: Add support for SHA256 and SHA512
Extend the xar reader and writer to understand the SHA256 (header
cksum_alg 3, 32 bytes, style "sha256") and SHA512 (cksum_alg 4, 64
bytes, style "sha512") checksum algorithms in addition to the existing
SHA1 and MD5.  These are the algorithm codes defined by the canonical
xar format, so archives written with them interoperate with Apple's xar,
pkgutil, and PackageKit.

Both the TOC ("toc-checksum") and per-file ("checksum") algorithms are
supported for writing.  New algorithm handling is guarded by
ARCHIVE_HAS_SHA256 / ARCHIVE_HAS_SHA512 so builds without those digests
are unaffected.  MAX_SUM_SIZE grows from 20 to 64 to hold a SHA512
digest.
2026-07-27 19:28:21 +02:00
Dustin L. Howett 4d3bfca239 Merge pull request #3327 from libarchive/dependabot/github_actions/all-actions-413c1c7ad7
CI: Bump the all-actions group with 6 updates
2026-07-27 12:01:12 -05:00
Jin 79b06edf6e archive_read: don't poison archive when seek is unsupported (fixes #3323)
3.8.8 ("make ARCHIVE_FATAL sticky in data-reading entry points",
commit e1f890dc) made archive_seek_data() set
a->archive.state = ARCHIVE_STATE_FATAL whenever the call returned
ARCHIVE_FATAL.  That is correct for genuine I/O / parse failures
returned by a format's seek_data() implementation, but it also
poisoned the archive in two cases where seeking is simply
unsupported for the current format:

  1. The seek_data == NULL branch in archive_seek_data() itself
     (no format_seek_data_block registered: ustar/tar, the
     streaming ZIP reader, ...).

  2. rar5_seek_data() in archive_read_support_format_rar5.c, which
     unconditionally returns ARCHIVE_FATAL because RAR5 is a
     streaming unpacker.  This was latent before 3.8.8 because
     the read core did not make FATAL sticky; the stickiness
     change exposed it.

Both are capability gaps, not stream corruption.  ARCHIVE_FATAL
must always be sticky (it means the archive is irrecoverably
damaged), so both sites now return ARCHIVE_FAILED with an error
string instead.  ARCHIVE_FAILED is recoverable: capability probes
such as

    if (archive_seek_data(a, 0, SEEK_CUR) >= 0) ...

learn that seeking is unavailable while the archive remains
usable for subsequent reads.  The sticky-on-genuine-FATAL part of
the original 3.8.8 change is preserved for actual ARCHIVE_FATAL
returns from a format's seek_data() implementation.

The seek_data == NULL branch also reports the condition better: a
format that never registers a seek hook is not illegal use of the
library, so the error is now ARCHIVE_ERRNO_MISC / "Cannot seek
data with this format" instead of ARCHIVE_ERRNO_PROGRAMMER /
"Internal error: No format_seek_data_block function registered".

The rar5 change also matches how the RAR4 reader already reports
the same situation (archive_read_support_format_rar.c:1339
returns ARCHIVE_FAILED for compressed RAR files).

This restores 3.8.7 behaviour for clients that probe seekability
before reading.  VLC's skins2 stream extractor
(modules/stream_extractor/archive.c, archive_seek_subentry())
probes with archive_seek_data(a, 0, SEEK_CUR); on a non-seekable
format the poisoned state killed all later archive_read_data()
calls, breaking ZIP-packed .vlt skins on distributions shipping
libarchive 3.8.8.

Tests:
  - test_archive_seek_data_unsupported: covers the seek_data==NULL
    branch using a ustar archive.
  - test_read_format_rar5_seek_data_unsupported: covers the
    rar5_seek_data() branch using an existing RAR5 fixture, and
    verifies the entry content with verify_data() after the probe.
  Both fail on master and pass with this change.
2026-07-28 00:30:34 +08:00
dependabot[bot] a8de0156d4 CI: Bump the all-actions group with 6 updates
Bumps the all-actions group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [acj/freebsd-firecracker-action](https://github.com/acj/freebsd-firecracker-action) | `0.10.4` | `0.11.0` |
| [github/codeql-action/init](https://github.com/github/codeql-action) | `4.37.1` | `4.37.3` |
| [github/codeql-action/autobuild](https://github.com/github/codeql-action) | `4.37.1` | `4.37.3` |
| [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.37.1` | `4.37.3` |
| [ossf/scorecard-action](https://github.com/ossf/scorecard-action) | `2.4.3` | `2.4.4` |
| [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) | `4.37.1` | `4.37.3` |


Updates `acj/freebsd-firecracker-action` from 0.10.4 to 0.11.0
- [Release notes](https://github.com/acj/freebsd-firecracker-action/releases)
- [Commits](https://github.com/acj/freebsd-firecracker-action/compare/0fe13161c7d388eed0570eac668e1ba8fc1f1e4e...e04896d2dd91f7ec7381e5f363c6fbe83ee445c3)

Updates `github/codeql-action/init` from 4.37.1 to 4.37.3
- [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/7188fc363630916deb702c7fdcf4e481b751f97a...e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81)

Updates `github/codeql-action/autobuild` from 4.37.1 to 4.37.3
- [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/7188fc363630916deb702c7fdcf4e481b751f97a...e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81)

Updates `github/codeql-action/analyze` from 4.37.1 to 4.37.3
- [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/7188fc363630916deb702c7fdcf4e481b751f97a...e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81)

Updates `ossf/scorecard-action` from 2.4.3 to 2.4.4
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/4eaacf0543bb3f2c246792bd56e8cdeffafb205a...2d1146689b8cda280b9bc96326124645441f03bc)

Updates `github/codeql-action/upload-sarif` from 4.37.1 to 4.37.3
- [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/7188fc363630916deb702c7fdcf4e481b751f97a...e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81)

---
updated-dependencies:
- dependency-name: acj/freebsd-firecracker-action
  dependency-version: 0.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: github/codeql-action/init
  dependency-version: 4.37.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.37.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.37.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: ossf/scorecard-action
  dependency-version: 2.4.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.37.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-27 16:13:38 +00:00
datauwu a96851a161 warc: name local variables
Replace short local names with clear names.

Match the common writer layout and return style.
2026-07-27 17:30:52 +08:00
carrerasdarren-cell 6ccaddb831 iso9660: test large no-emulation boot image 2026-07-23 11:20:41 -04:00
datauwu a1f1de994e warc: name helper functions
Give private helpers clear WARC names.

Make the UUID helper return void.
2026-07-23 22:07:11 +08:00
datauwu d4aa000ea5 warc: name internal types and fields
Replace short names with clear WARC names.

Move the header size limit to file scope.
2026-07-23 22:07:11 +08:00
datauwu 2a672716cc warc: use writer callback names
Use the same callback form as other format writers.

Clean the prototypes and remove old section marks.
2026-07-23 22:07:11 +08:00
datauwu 454168772b program: fix dangling pointer after close
Store the program filter description in the bidder state instead of the
active filter state.

The active state is freed by archive_read_close(), while the bidder state
remains valid until archive_read_free(). This keeps archive_filter_name()
from returning a dangling pointer.
2026-07-22 03:12:04 +08:00
datauwu 6cab05dbd5 program: test filter name after close
Verify that the external program filter name remains available after
archive_read_close().
2026-07-22 03:12:04 +08:00
Dustin L. Howett f5509ae993 Merge pull request #3299 from datauwu/tar-read-fix-uaf
tar: fix UAF when reading GNU sparse headers
2026-07-21 13:13:03 -05:00
Dustin L. Howett 0b71b606dd Merge commit from fork
Fix RAR seek_data cursor underflow
2026-07-21 12:55:13 -05:00
Dustin L. Howett 8dec814f98 Merge pull request #3318 from carrerasdarren-cell/fix/mac-metadata-self-copy-uaf
archive_entry: handle aliased Mac metadata copies
2026-07-21 12:48:06 -05:00
carrerasdarren-cell a8bff73641 archive_entry: handle aliased Mac metadata copies 2026-07-21 11:54:13 -04:00
carrerasdarren-cell 925a3a385f archive_entry: test aliased Mac metadata copies 2026-07-21 11:54:05 -04:00