Tim Kientzle
a16834cfc6
Merge pull request #3373 from stoeckmann/mem_seek
...
memory: Adjust seek logic
2026-08-11 19:38:17 -07:00
Tim Kientzle
6ea9e10bc5
Merge pull request #3321 from carrerasdarren-cell/fix/cpio-newc-inode-synthesis
...
cpio: synthesize newc inode values
2026-08-10 06:58:16 -07:00
Tim Kientzle
ca8b5cdfe3
Merge pull request #3345 from PeiweiHu/peiwei_fix
...
Fix bsdtar’s `@archive` handling by freeing input readers after open failures and applying passphrases to the correct reader object.
2026-08-03 22:16:19 -07: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
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
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
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
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
Tim Kientzle
4840347569
Merge pull request #616 from chenxiaolong/android-utf8
...
Force UTF-8 as the default charset on Android
2026-07-19 15:46:59 -07:00
Tim Kientzle
097119fc0f
Merge pull request #3308 from datauwu/warc-reject-truncated-file-data
...
warc: reject truncated file data
2026-07-19 15:33:19 -07:00
Tim Kientzle
e26d91cef1
Merge pull request #3309 from stoeckmann/write_huge
...
write: Correctly handle huge write requests
2026-07-19 15:28:53 -07:00
Tim Kientzle
e70bf490b8
Merge pull request #3301 from datauwu/zip-remove-redundant-helper
...
zip: remove redundant helper
2026-07-19 08:47:07 -07:00
Tim Kientzle
cb550d2791
Merge pull request #3303 from datauwu/xar-write-fix-null-deref
...
xar: fix NULL dereference on allocation failure
2026-07-19 08:41:27 -07:00
Tim Kientzle
ae8f0ccceb
Merge pull request #3305 from datauwu/formats-various-cleanup
...
formats: simplify string handling
2026-07-19 08:39:55 -07:00
Tim Kientzle
30708c06c8
Merge pull request #3307 from stoeckmann/warc_digit
...
warc: Avoid `isdigit` in version number check
2026-07-19 08:03:20 -07:00
Tim Kientzle
46e9236e4e
Merge pull request #3272 from daandemeyer/push-kysumqozmsuq
...
pax: add "align" write option for reflink-friendly archives
2026-07-13 07:53:21 -07:00
Tim Kientzle
6bbaf0ad41
Merge pull request #3286 from uchiha-bug-hunter/xar-parse-time-overread
...
xar: fix one-byte over-read in parse_time date parser
2026-07-13 07:36:17 -07:00
Tim Kientzle
2139626099
Merge pull request #3276 from DHowett/dh/fix-archive-literals
...
tidy: prefer ARCHIVE_OK over 0 when appropriate
2026-07-10 20:40:54 -07:00
Tim Kientzle
2ff2b423e7
Merge pull request #3275 from datauwu/fix-several-left-shift-ub
...
libarchive: fix left-shift UB in several places
2026-07-10 10:29:24 -07:00
Tim Kientzle
f4786afb10
Merge pull request #3250 from datauwu/tar-avoid-redundant-size
...
tar: avoid redundant Solaris ACL size parsing
2026-07-06 07:11:54 -07:00
Tim Kientzle
d81b9f5582
Merge pull request #3252 from datauwu/tar-fix-oob-read
...
tar: fix 1-byte OOB read in SUN.holesdata parsing
2026-07-06 07:06:58 -07:00
Tim Kientzle
f2f3eb9f50
Merge pull request #3245 from kientzle/kientzle-archive-read-failed-header-recovery
...
[Read core] Allow format handlers to FAIL a header read
2026-07-05 10:36:10 -07:00
Tim Kientzle
16d8156deb
[Read core] Allow format readers to FAIL a header read
...
While investigating improvements to Zip's header reading,
I found an overlooked case in the read core: When a format
returned FAILED for a header read (indicating that the entry
could not be read but that the archive as a whole is still valid),
the core silently converted that to FATAL, ending the archive
at that point.
The change to the read core adds a new internal state "DATA_RECOVERY"
indicating that we're post-header (like the existing DATA state) but
that client requests to actually obtain data are not valid.
2026-07-05 10:12:33 -07:00
Tim Kientzle
0409837cb9
[Read core] Test handling of FAILED header reads
...
While investigating improvements to Zip's header reading,
I found an overlooked case in the read core: When a format
returned FAILED for a header read (indicating that the entry
could not be read but that the archive as a whole is still valid),
the core silently converted that to FATAL, ending the archive
at that point.
Two formats already returned FAILED for certain header issues:
Zip and LHA both indicated unreadable symlink entries in this way,
which should allow the rest of the archive to continue being read.
New tests here verify that we can now continue reading past
such entries, and that clients who ignore the FAILED result
get the same FATAL handling as other API misuse.
2026-07-05 10:11:50 -07:00
Tim Kientzle
f7965ac947
Merge pull request #3242 from datauwu/zip-basic-support-0x000d
...
zip: read PKWARE Unix extra field metadata
2026-07-05 08:38:11 -07:00
Tim Kientzle
d21fdc9f84
Merge pull request #3240 from kientzle/kientzle-zip-uncompressed-size-exact-check
...
[Zip] Reject archives if the 32-bit size field is not correct
2026-07-04 22:06:35 -07:00
Tim Kientzle
f66b4c7f8f
Merge pull request #3238 from stoeckmann/cpio_ioflow
...
cpio: Prevent signed integer overflow
2026-07-04 10:43:37 -07:00
Tim Kientzle and Tobias Stoeckmann
1ff24fb981
Update libarchive/archive_read_data_into_fd.c
...
Co-authored-by: Tobias Stoeckmann <stoeckmann@users.noreply.github.com >
2026-07-04 09:48:31 -07:00
Tim Kientzle
d2a224f443
Fix the test failure
...
This was originally developed without the Zip fix from #3230 .
Since that's been merged, we need to adjust the expectations here
a bit.
2026-07-03 21:52:27 -07:00
Tim Kientzle
ec36bf4179
Rework size-overrun check to avoid arithmetic errors
2026-07-03 21:41:08 -07:00
Tim Kientzle
aba955e416
[Write] Truncate write-to-fd at the declared entry size
...
This is the fix for....
Update the common archive_read_data_into_fd() to truncate
output to the actual entry size from the most recent
archive_read_header result.
This addresses a hole in handling of certain subtly-malformed archives
that can have more data than declared in the header. Before this,
bsdtar explicitly truncates the entry data to the actual declared size
when extracting to a file, but did not do so when extracting to
stdout.
2026-07-03 21:41:08 -07:00
Tim Kientzle
e7e408a1a9
[Write] Truncate write-to-fd at the declared entry size
...
This is the test for....
Update the common archive_read_data_into_fd() to truncate
output to the actual entry size from the most recent
archive_read_header result.
This addresses a hole in handling of certain subtly-malformed archives
that can have more data than declared in the header. Before this,
bsdtar explicitly truncates the entry data to the actual declared size
when extracting to a file, but did not do so when extracting to
stdout.
2026-07-03 21:41:08 -07:00
Tim Kientzle
ba542208a3
[Zip] Reject archives if the 32-bit size field is not correct
...
Reverse an old experiment: When the 32-bit size field is provided, it
now must match the actual size exactly. We no longer permit it to
only match the least-significant 32 bits of the actual size.
--begin-history--
When developing the earliest versions of libarchive's Zip support, I
experimented with the idea of supporting greater-than-4GiB entries in
32-bit Zip archives. This proved to be technically feasible as long
as the _compressed_ data was small enough to keep the resulting
archive under 4GiB. But this also required us to interpret
the 32-bit uncompressed size field as representing only the
least-significant 32 bits of the size.
--end-history--
2026-07-03 21:25:54 -07:00
Tim Kientzle
1559ae86da
[Zip] Be strict about the 32-bit uncompressed size
...
Test: If the uncompressed size stored in the archive differs
from the actual uncompressed size by a multiple of 2^32,
we should report some kind of error.
This currently goes undiagnosed because of an old attempt
to support larger-than-4GiB entries in plain 32-bit Zip
archives without necessarily requiring Zip64 extensions.
While this is technically feasible, it requires treating
the 32-bit size field ambiguously, which can lead to size
confusion from readers.
2026-07-03 21:22:48 -07:00
Tim Kientzle
5a2ec45b9c
Merge pull request #3230 from kientzle/kientzle-zip-reject-overlong-bodies
...
[Zip] Reject entries with overlong bodies
2026-07-03 13:26:30 -07:00
Tim Kientzle
c11df428d1
[Zip] Reject entries with overlong bodies
...
If an entry declares an uncompressed size, we should not return any
data beyond that point. This doesn't impact bsdtar and friends since
they independently truncate to the declared entry size, but other
clients may not be so careful.
Apparently discovered (but not reported) by @bikini
Reported by @dkgkdfg65
2026-07-03 13:14:27 -07:00
Tim Kientzle
5f29836190
[Zip] Reject entries with overlong bodies
...
Tests for...
If an entry declares an uncompressed size, we should not return any
data beyond that point. This doesn't impact bsdtar and friends since
they independently truncate to the declared entry size, but other
clients may not be so careful.
Apparently discovered (but not reported) by @bikini
Reported by @dkgkdfg65
2026-07-03 13:13:31 -07:00
Tim Kientzle
47999c275f
Merge pull request #3228 from datauwu/zip-encrypted-int-overflow
...
zip: avoid signed overflow in encrypted size checks
2026-07-03 09:36:45 -07:00
Tim Kientzle
82c0149234
Merge pull request #3188 from cyphercodes/fix-3151-empty-pax-headers
...
Reject empty pax extended headers
2026-06-27 09:03:47 -07:00
Tim Kientzle
6f85565e42
Merge pull request #3175 from uchiha-bug-hunter/xar-base64-oob-read
...
xar: fix OOB read decoding odd-length base64 in strappend_base64
2026-06-24 06:10:15 -07:00
Tim Kientzle
94daafd6fb
Merge pull request #3178 from uchiha-bug-hunter/unzip-pathname-dotdot
...
unzip: reject bare '..' and trailing '/..' in pathname_is_insecure
2026-06-24 06:08:25 -07:00
Tim Kientzle
bf268f086d
Merge pull request #3106 from stoeckmann/precompute_tables
...
Precompute static tables
2026-06-02 21:10:22 -07:00
Tim Kientzle
e48b9c4cf4
Merge pull request #3107 from stoeckmann/dynamic
...
Turn static state variables dynamic
2026-06-02 21:09:33 -07:00
Tim Kientzle
b660b6965c
Merge pull request #3110 from stoeckmann/static_style
...
Turn two static tables `static const`
2026-06-02 21:08:35 -07:00
Tim Kientzle
6895434b64
Merge pull request #3111 from stoeckmann/tests_assert_a
...
tests: Use assertEqualInt for archive_write_free
2026-06-02 21:07:42 -07:00
Tim Kientzle
a70de97aab
Merge pull request #3092 from vmihalis/https-config-fetch
...
build: fetch config.guess/config.sub over HTTPS
2026-05-29 09:00:39 -07:00
Tim Kientzle
c15997d4f3
Merge pull request #3061 from tosanjay/warc-header-popul-ehdr-leak
...
warc writer: free hdr on _popul_ehdr overflow in _warc_header
2026-05-26 21:02:28 -07:00
Tim Kientzle
43a5035657
Merge pull request #3078 from vlmarek/solaris-skip-string-conversion-fail-tests
...
Skip tests where Solaris iconv substitutes invalid chars
2026-05-26 20:29:44 -07:00
Tim Kientzle
c97baadd86
Merge pull request #3056 from markjdb/master
...
libarchive: Force GNU iconv compatibility on FreeBSD
2026-05-20 15:57:07 -07:00
Tim Kientzle
2e183f664c
Merge pull request #3054 from i1011/add-filter-mismatch-fix
...
filter: Fix mismatched filter function dispatch table entry in archive_write_add_filter.c
2026-05-20 15:55:18 -07:00
Tim Kientzle
c18a5c7e5f
Merge pull request #3040 from kientzle/fix/unchecked-alloc
...
Fix a number of unchecked memory allocations
2026-05-16 15:04:07 -07:00
Tim Kientzle
7ef136b750
Fix unchecked malloc result in XXH32_init
...
If XXH_malloc fails, state would be NULL and passed directly to
XXH32_resetState, causing a NULL dereference.
2026-05-16 10:04:51 -07:00
Tim Kientzle
cb231e2b39
Fix unchecked strdup result in __archive_write_program_allocate
...
If strdup fails, program_name would be NULL and later use could crash.
Free data and return NULL on allocation failure.
2026-05-16 10:04:38 -07:00
Tim Kientzle
620bdafa26
Fix unchecked calloc results in init_unpack (rar5)
...
window_buf and filtered_buf were allocated via calloc without checking
for NULL. Change init_unpack to return int and propagate ARCHIVE_FATAL
on allocation failure to the caller.
2026-05-16 10:04:24 -07:00
Tim Kientzle
059dff39be
Fix unchecked calloc result in make_table (rar)
...
If calloc fails, code->table would be NULL and passed directly to
make_table_recurse, causing a NULL dereference.
2026-05-16 10:03:31 -07:00
Tim Kientzle
42151837dc
Fix unchecked calloc result in tree_open
...
If calloc fails, t would be NULL and immediately dereferenced.
Return NULL on allocation failure.
2026-05-16 10:03:11 -07:00
Tim Kientzle
f5bb79a62e
Fix unchecked calloc result in tree_push
...
If calloc fails, te would be NULL and immediately dereferenced.
Return early on allocation failure.
2026-05-16 10:02:57 -07:00
Tim Kientzle
589004793a
Fix unchecked malloc result in read_reparse_data
...
If malloc fails, indata would be NULL and passed directly to
DeviceIoControl, causing undefined behavior.
2026-05-16 10:02:30 -07:00
Tim Kientzle
89a6d760c1
Merge pull request #3032 from stoeckmann/dotdot
...
Port iso9660 fix for `..` (dot dot) path normalization to mtree and xar
2026-05-16 09:39:31 -07:00
Tim Kientzle
27b08f61da
Merge pull request #3028 from br0nzu/xar-fstype-cleanup
...
Free XAR xattr fstype metadata during cleanup
2026-05-13 19:24:27 -07:00
Tim Kientzle
6d15675331
Merge pull request #3030 from stoeckmann/xar_atol
...
xar: Avoid integer overflows in number parsers
2026-05-13 18:51:45 -07:00
Tim Kientzle
d0ee2d32ef
Merge pull request #3029 from stoeckmann/iso_memleak
...
iso9660: Fix memory leaks on error paths
2026-05-13 18:51:29 -07:00
Tim Kientzle
1546fbffe8
Merge pull request #3020 from stoeckmann/sparse_uaf_test
...
sparse: Add archive_entry_sparse_reset test
2026-05-10 08:45:58 -07:00
Tim Kientzle
dca1bcd27d
Merge pull request #3016 from ZX41R/oss-fuzz-write-disk-secure-coverage
...
Improve write-disk fuzzer coverage
2026-05-09 14:12:56 -07:00
Tim Kientzle
6246a35326
Merge pull request #3015 from datauwu/master
...
rar: avoid reading NEWSUB extended data during header parsing
2026-05-09 14:10:02 -07:00
Tim Kientzle
0ec85e45e4
Merge pull request #2978 from stoeckmann/joliet_id_loop
...
iso9660: Fix infinite loop in Joliet ID generation
2026-05-09 13:50:41 -07:00
Tim Kientzle
5ed0b5ea88
Merge pull request #2928 from stoeckmann/anchor_no_flags
...
pathmatch: Treat anchors not special without flags
2026-05-09 13:49:25 -07:00
Tim Kientzle
5aa477220e
Merge pull request #2927 from stoeckmann/pathmatch_recursion
...
archive_match: Prevent call stack overflow
2026-05-09 13:48:20 -07:00
Tim Kientzle
dda246a62e
Merge pull request #2930 from stoeckmann/mtree_option
...
mtree: Fix time value parser truncation
2026-05-09 09:15:26 -07:00
Tim Kientzle
abed05f954
Merge pull request #2929 from stoeckmann/7zip_codec_id
...
7zip: Verify that Codec ID fits into 63 bit
2026-05-09 09:14:11 -07:00
Tim Kientzle
c25415ade4
Merge pull request #2982 from stoeckmann/mtree_hex
...
mtree: Fix hex parser
2026-05-09 09:11:14 -07:00
Tim Kientzle
a330921e49
Merge pull request #2974 from stoeckmann/joliet_id
...
iso9660: Fix OOB during Joliet ID generation
2026-05-09 09:10:07 -07:00
Tim Kientzle
3f7a004055
Merge pull request #2969 from stoeckmann/glibc234
...
Fix build with glibc 2.43
2026-05-09 08:58:28 -07:00
Tim Kientzle
f5166ca923
Merge pull request #3019 from kientzle/kientzle-sparse-uaf-012
...
[sparse] UAF in sparse_reset
2026-05-08 19:04:25 -07:00
Tim Kientzle
bcb158d409
Merge pull request #3018 from tbkka/tbkka-mtree-null-deref-014
...
[MTREE] NULL pointer deref during archive close
2026-05-08 19:03:11 -07:00
Tim Kientzle
b1622a8e55
[sparse] UAF in sparse_reset
2026-05-08 18:48:45 -07:00
Tim Kientzle
98f3579020
Merge pull request #3017 from tbkka/tbkka-iso9660-015-019
...
[ISO9660] Fix NULL deref and Joliet ID overflow
2026-05-08 16:27:48 -07:00
Tim Kientzle
cb9f77e6e5
Merge pull request #3013 from tbkka/tbkka-xar-undefined-011-018
...
[XAR] Fix two UB
2026-05-08 15:40:05 -07:00
Tim Kientzle
411a4479b9
Merge pull request #2984 from tyler-yankee/cpio-hardlink-pathname-null
...
cpio reader: Validate pathname in record_hardlink
2026-05-08 10:16:29 -07:00
Tim Kientzle
1fcae10bf7
Merge pull request #3014 from kientzle/kientzle-test_utils-ub
...
[test_utils] Fix a minor UB
2026-05-07 22:20:19 -07:00
Tim Kientzle
7c9ad86cf4
[7zip] Another shift UB caused by integer promotion
2026-05-07 22:04:20 -07:00
Tim Kientzle
e46e2c389a
[test_utils] Fix a minor UB
...
(UBSan occasionally finds something interesting and
often reports whacky non-bugs like this one. "Fixing"
it will make the real UB bugs easier to identify, so...)
According to C's integer promotion rules, `unsigned short` gets
promoted to _signed_ `int`, and shifting into the sign bit of an `int`
is technically UB. Explicit cast to `unsigned` quiets UBSan.
2026-05-07 21:50:50 -07:00
Tim Kientzle
b3b546d008
Merge pull request #3012 from tbkka/tbkka-pathmatch-buffer-overread-003
...
[pathmatch] Heap buffer over-read
2026-05-07 21:40:10 -07:00
Tim Kientzle
58810c2fae
Merge pull request #3011 from tbkka/tbkka-tar-acl-oob-002
...
[ACL] Parser out-of-bounds read
2026-05-07 21:31:14 -07:00
Tim Kientzle
46290f89c7
Merge pull request #3008 from jlduran/fix-root-mtree
...
mtree: Do not append '/' when basename is '.'
2026-05-07 19:52:41 -07:00
Tim Kientzle
c6322495f1
Merge pull request #3010 from kientzle/kientzle-overlarge-dates
...
Date parsing: reject dates with numbers of more than 4 digits
2026-05-07 18:21:00 -07:00
Tim Kientzle
692e88b287
Fix build error
2026-05-07 17:50:07 -07:00
Tim Kientzle
422aae80ae
Date parsing: reject date components with numbers of more than 4 digits
...
Only the Unix epoch format `@<timestamp>` can have a number with
more than 4 digits. So let's break out the numeric parsing into
a standalone uint64 parser and use it separately to parse epoch
timestamps (which are only limited by the range of time_t) and
other date components.
It also avoids a time-consuming leap-year correction for
nonsensically large year values.
2026-05-07 17:36:13 -07:00
Tim Kientzle
73c4f1c03f
Merge pull request #3009 from kientzle/archive-read-sticky-fatal
...
Minor cleanups from #2298
2026-05-07 12:41:30 -07:00
Tim Kientzle
9a61f7baa5
Cleanup a new test, fill in some missing assertions
2026-05-07 12:25:58 -07:00
Tim Kientzle
e01eeb274d
Merge pull request #2998 from kientzle/archive-read-sticky-fatal
...
archive_read: FATAL should be sticky for all API calls
2026-05-07 12:19:02 -07:00
Tim Kientzle
74107b8110
TODO seems to have been addressed; remove
2026-05-07 09:45:17 -07:00
Tim Kientzle
4b65c3866b
Merge pull request #3007 from jlduran/escape-vis-glob-chars
...
mtree: Escape standard pathname matching characters
2026-05-07 08:34:11 -07:00
Tim Kientzle
bdf827634b
Restore verbosity
2026-05-06 23:25:10 -07:00
Tim Kientzle
a1b525e654
Fix CMake style
2026-05-06 23:24:53 -07:00
Tim Kientzle
2040158905
Restore switch_multivolume as needed
2026-05-06 23:16:57 -07:00
Tim Kientzle
d5d9e1fd36
Adjust tests
2026-05-06 22:15:11 -07:00
Tim Kientzle
f833d13e6d
Fix CMake-based testing
2026-05-06 22:02:15 -07:00
Tim Kientzle
6f40ee4f1d
Make default test output verbose, for better CI info
2026-05-06 18:56:13 -07:00
Tim Kientzle
4fde023514
Merge pull request #3006 from stoeckmann/7zip_32
...
7zip: Fix 32 bit heap overflow
2026-05-06 11:52:11 -07:00