Compare commits

...
661 Commits
Author SHA1 Message Date
Martin Matuska 27cbc78271 Release 3.8.9 2026-07-28 11:14:47 +02:00
Dustin L. Howett 9f08f77e61 Merge pull request #3315 from datauwu/iso9660-remove-per-reader-comp-buf
iso9660: remove per-reader zero comparison buffer
(cherry picked from commit 40da2cdc52)
2026-07-28 11:12:06 +02:00
Dustin L. Howett c79cf80dbc Merge pull request #3302 from datauwu/program-read-fix-uaf
program: fix dangling pointer after close
(cherry picked from commit 10ea0e7499)
2026-07-28 11:12:01 +02:00
Dustin L. Howett db52c65ddc Merge pull request #3317 from stoeckmann/rar5_varint
rar5: Improve varint handling
(cherry picked from commit e207c4b357)
2026-07-28 00:39:38 +02:00
Tim Kientzle 55894641b2 Merge pull request #3329 from dag-erling/des/xar-unsup-digest
xar: Fix for unsupported digests
(cherry picked from commit 4c5854ed69)
2026-07-28 00:39:34 +02:00
Dustin L. Howett a3189af7c7 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)

(cherry picked from commit ca6e125867)
2026-07-28 00:39:28 +02:00
Dustin L. Howett 773061ff4c Merge pull request #3322 from datauwu/warc-writer-unify
warc: match other writer styles
(cherry picked from commit 3e6d656c80)
2026-07-28 00:39:23 +02:00
Tim Kientzle e8999de183 Merge pull request #3328 from dag-erling/des/xar-sha2
xar: Add support for SHA256 and SHA512
(cherry picked from commit b722e2cccc)
2026-07-28 00:39:11 +02:00
Dustin L. Howett 0eb1dabdae Merge pull request #3327 from libarchive/dependabot/github_actions/all-actions-413c1c7ad7
CI: Bump the all-actions group with 6 updates
(cherry picked from commit 4d3bfca239)
2026-07-28 00:38:53 +02:00
Dustin L. Howett 12d40a22e0 Merge pull request #3299 from datauwu/tar-read-fix-uaf
tar: fix UAF when reading GNU sparse headers
(cherry picked from commit f5509ae993)
2026-07-26 20:26:44 +02:00
Dustin L. Howett 41180e15fc Merge commit from fork
Fix RAR seek_data cursor underflow

(cherry picked from commit 0b71b606dd)
2026-07-26 20:26:39 +02:00
Dustin L. Howett 45f7ec5422 Merge pull request #3318 from carrerasdarren-cell/fix/mac-metadata-self-copy-uaf
archive_entry: handle aliased Mac metadata copies

(cherry picked from commit 8dec814f98)
2026-07-26 20:26:32 +02:00
Dustin L. Howett 1e17c0bc07 Merge pull request #3316 from libarchive/dependabot/github_actions/all-actions-3c55da1aaa
CI: Bump the all-actions group with 6 updates
(cherry picked from commit 33da30bd9c)
2026-07-26 20:26:24 +02:00
Dustin L. Howett 11077ac395 Merge pull request #3306 from stoeckmann/data
(cherry picked from commit 3a8f29903f)
2026-07-26 20:26:15 +02:00
Tim Kientzle c1953e8d12 Merge pull request #616 from chenxiaolong/android-utf8
Force UTF-8 as the default charset on Android

(cherry picked from commit 4840347569)
2026-07-26 20:26:06 +02:00
Tim Kientzle 783003f1f5 Merge pull request #3308 from datauwu/warc-reject-truncated-file-data
warc: reject truncated file data
(cherry picked from commit 097119fc0f)
2026-07-26 20:26:01 +02:00
Tim Kientzle 5be8bf4704 Merge pull request #3309 from stoeckmann/write_huge
write: Correctly handle huge write requests
(cherry picked from commit e26d91cef1)
2026-07-26 20:25:54 +02:00
Tim Kientzle 764c006ee6 Merge pull request #3301 from datauwu/zip-remove-redundant-helper
zip: remove redundant helper
(cherry picked from commit e70bf490b8)
2026-07-26 20:25:44 +02:00
Tim Kientzle 5a2845f14c Merge pull request #3303 from datauwu/xar-write-fix-null-deref
xar: fix NULL dereference on allocation failure
(cherry picked from commit cb550d2791)
2026-07-26 20:25:38 +02:00
Tim Kientzle da6d06288f Merge pull request #3305 from datauwu/formats-various-cleanup
formats: simplify string handling
(cherry picked from commit ae8f0ccceb)
2026-07-26 20:25:32 +02:00
Tim Kientzle 29f3af2f5b Merge pull request #3307 from stoeckmann/warc_digit
warc: Avoid `isdigit` in version number check
(cherry picked from commit 30708c06c8)
2026-07-26 20:25:27 +02:00
Dustin L. Howett a50aed7cb1 Merge pull request #3292 from datauwu/xar-fix-mem-leaks
xar: fix several memory leaks
(cherry picked from commit 84fbafad32)
2026-07-26 20:25:12 +02:00
Dustin L. Howett 9dde11c5a2 Merge pull request #3297 from datauwu/archive-write-fix-uaf
archive_write: fix UAF when switching formats

(cherry picked from commit d141f661da)
2026-07-26 20:25:03 +02:00
Dustin L. Howett 148a9f90c1 Merge pull request #3294 from datauwu/bsdtar-fix-signed-overflow
(cherry picked from commit 10a7247810)
2026-07-26 20:24:58 +02:00
Dustin L. Howett c0dcda10c0 Merge pull request #3296 from stoeckmann/filter_writer
(cherry picked from commit b85488c37a)
2026-07-26 20:24:53 +02:00
Dustin L. Howett 7007cebd12 Merge pull request #3295 from stoeckmann/typos_2
Fix typos

(cherry picked from commit 47d94d1f92)
2026-07-26 20:24:45 +02:00
Dustin L. Howett 764da28499 Merge pull request #3293 from DHowett/iso9660-nmlen
(cherry picked from commit 0362c77f9f)
2026-07-26 20:24:33 +02:00
Dustin L. Howett 825d6a6049 Merge pull request #3243 from datauwu/tar-prefer-native-appledouble
tar: prefer multibyte pathname for AppleDouble checks
(cherry picked from commit 87f72b5e6a)
2026-07-26 20:24:16 +02:00
Dustin L. Howett 54f11c3480 Merge pull request #3290 from stoeckmann/cab_skip
cab: Check `__archive_read_consume` result
(cherry picked from commit bd57e425f1)
2026-07-26 20:24:11 +02:00
Dustin L. Howett 15fe82079b Merge pull request #3289 from uchiha-bug-hunter/pax-base64-checked-size
(cherry picked from commit 8d66ccf261)
2026-07-26 20:24:00 +02:00
Dustin L. Howett d3729ca1b5 Merge pull request #3284 from datauwu/warc-propagate-generated-header-errors
warc: propagate generated header errors
(cherry picked from commit 9e0bae9458)
2026-07-26 20:23:56 +02:00
Dustin L. Howett 9825d81a78 Merge pull request #3264 from stoeckmann/options_const
options: Use const char pointer where possible
(cherry picked from commit d5a15c706c)
2026-07-26 20:23:45 +02:00
Dustin L. Howett 918cb1779e Merge pull request #3247 from stoeckmann/strnlen
Use strnlen if available

(cherry picked from commit ed6475a64c)
2026-07-26 20:23:35 +02:00
Dustin L. Howett 696cb76f1b Merge pull request #3278 from uchiha-bug-hunter/cpio-trailer-uaf
cpio: add regression test for symlink-trailer end-of-archive check
(cherry picked from commit a6a899d655)
2026-07-26 20:23:26 +02:00
Dustin L. Howett 1615b934f8 Merge pull request #3287 from libarchive/dependabot/github_actions/all-actions-bfcd148bc6
CI: Bump the all-actions group across 1 directory with 5 updates
(cherry picked from commit 03b665040a)
2026-07-26 20:23:22 +02:00
Tim Kientzle 2733e72b47 Merge pull request #3272 from daandemeyer/push-kysumqozmsuq
pax: add "align" write option for reflink-friendly archives
(cherry picked from commit 46e9236e4e)
2026-07-26 20:23:15 +02:00
Tim Kientzle f171098f18 Merge pull request #3286 from uchiha-bug-hunter/xar-parse-time-overread
xar: fix one-byte over-read in parse_time date parser
(cherry picked from commit 6bbaf0ad41)
2026-07-26 20:23:10 +02:00
Dustin L. Howett 2e0028f32d Merge pull request #3270 from daandemeyer/push-qnzponoyonzo
test_sparse_basic: avoid out-of-bounds pointer arithmetic in verify

(cherry picked from commit d888c11d18)
2026-07-26 20:23:01 +02:00
Dustin L. Howett 2592af3ef2 Merge pull request #3282 from datauwu/warc-reject-incomplete-resource-records
warc: reject incomplete resource records
(cherry picked from commit d030af0ab7)
2026-07-26 20:22:57 +02:00
Dustin L. Howett 793829d87d Merge pull request #3285 from datauwu/uu-fix-null-memcpy-ub
uu: fix null pointer UB in EOF buffering
(cherry picked from commit ffc377a02f)
2026-07-26 20:22:53 +02:00
Dustin L. Howett d7d4d41c4c Merge pull request #3277 from datauwu/cpio-fix-pointer-lifetime
(cherry picked from commit 5d25dac1a7)
2026-07-26 20:22:44 +02:00
Dustin L. Howett 048a2ad207 Merge pull request #3280 from stoeckmann/warc_cleanup
(cherry picked from commit 4436696356)
2026-07-26 20:22:40 +02:00
Dustin L. Howett 2631a5fb75 Merge pull request #3281 from stoeckmann/warc_bid_check
(cherry picked from commit ade8de6f77)
2026-07-26 20:22:34 +02:00
Tobias Stoeckmann 32e07d6c8e Merge pull request #3279 from datauwu/warc-modernize-comments
warc: modernize comments
(cherry picked from commit da33bf2d71)
2026-07-26 20:21:52 +02:00
Tim Kientzle b09472e769 Merge pull request #3276 from DHowett/dh/fix-archive-literals
tidy: prefer ARCHIVE_OK over 0 when appropriate
(cherry picked from commit 2139626099)
2026-07-26 20:21:36 +02:00
Dustin L. Howett 172240f7eb Merge pull request #3274 from datauwu/warc-fix-oob-read
warc: parse Content-Length as a bounded field
(cherry picked from commit 98d1ceeca6)
2026-07-26 20:21:27 +02:00
Tim Kientzle febce1c072 Merge pull request #3275 from datauwu/fix-several-left-shift-ub
libarchive: fix left-shift UB in several places
(cherry picked from commit 2ff2b423e7)
2026-07-26 20:21:23 +02:00
Dustin L. Howett 1a4c198239 Merge pull request #3257 from R4mbb/fix-pax-all-slash-pathname
pax: handle all-slash pathnames in USTAR name splitting
(cherry picked from commit 8d62a0512a)
2026-07-26 20:21:15 +02:00
Dustin L. Howett be6f3d7aa6 Merge pull request #3256 from stoeckmann/cab_integers
cab: Refactor data types + extend huffman tables to 16 bit if needed
(cherry picked from commit cb2c1207f0)
2026-07-26 20:21:09 +02:00
Tobias Stoeckmann 665a8ccd25 Merge pull request #3259 from uchiha-bug-hunter/7zip-bound-header-counts
7zip: bound folder and stream counts before allocating
(cherry picked from commit ba202cdafc)
2026-07-26 20:20:57 +02:00
Dustin L. Howett 9b850de4bc Merge pull request #3266 from datauwu/pax-fix-oob-read
pax: fix 1-byte OOB read in sparse name building
(cherry picked from commit 1e48c53e9e)
2026-07-26 20:20:53 +02:00
Dustin L. Howett 6b919b34bd Merge pull request #3267 from datauwu/iso9660-fix-oob
iso9660: fix 1-byte OOB read in iso-level option
(cherry picked from commit cfb3eb5497)
2026-07-26 20:20:49 +02:00
Dustin L. Howett 3e09b6805c Merge pull request #3268 from uchiha-bug-hunter/best-effort-strncat-overread
archive_string: bound best_effort_strncat_in_locale to length

(cherry picked from commit 1d7b49b8d9)
2026-07-26 20:20:43 +02:00
Dustin L. Howett cf80ac317e Merge pull request #3265 from stoeckmann/ckd_alloc
Check size arithmetic before memory allocations

(cherry picked from commit 40a71c8382)
2026-07-26 20:20:23 +02:00
Dustin L. Howett 96a2a6c008 Merge pull request #3214 from uchiha-bug-hunter/tar-sun-holesdata-overread
tar: add regression test for SUN.holesdata sparse map ending on a digit
(cherry picked from commit 6752ed2c27)
2026-07-26 20:20:18 +02:00
Tobias Stoeckmann cdce9e7943 Merge pull request #3220 from DHowett/fix-assertions-lstat
test: make Windows file assertions act like lstat
(cherry picked from commit 761652401f)
2026-07-26 20:20:10 +02:00
Dustin L. Howett e61c920fa7 Merge pull request #3249 from datauwu/warc-fix-pending-data
warc: fix pending data when skipping entries
(cherry picked from commit 8324372849)
2026-07-26 20:20:01 +02:00
Dustin L. Howett 0c7012eb12 Merge pull request #3227 from DHowett/windows-bsdtar-fix-upper-h-mode
win32: fix symlink mode 'H' (hybrid) in wildcard search
(cherry picked from commit 4c7066dd98)
2026-07-26 20:19:55 +02:00
Dustin L. Howett 63f4a201df Merge pull request #3258 from uchiha-bug-hunter/mtree-global-set-overread
mtree: fix out-of-bounds read in process_global_set
(cherry picked from commit f0af7530a1)
2026-07-26 20:19:47 +02:00
Dustin L. Howett 9bff9c306f Merge pull request #3262 from datauwu/zip-fix-oob-read
zip: fix 1-byte OOB read in Mac extension check
(cherry picked from commit 512675e432)
2026-07-26 20:19:40 +02:00
Dustin L. Howett 946fd38679 Merge pull request #3263 from datauwu/bsdtar-fix-oob-read
bsdtar: fix 1-byte OOB read in substitution handling
(cherry picked from commit 108381c805)
2026-07-26 20:19:35 +02:00
Dustin L. Howett fce49a37b6 Merge pull request #3260 from mmatuska/constify-fix
7-zip and rar5: add constifications missing in e150c2f41 (#3113)

(cherry picked from commit a6b6c50c3b)
2026-07-26 20:19:28 +02:00
Dustin L. Howett 4aa4582929 Merge pull request #3223 from DHowett/win32-o-excl
win32: prevent writing through a broken symlink in insecure mode
(cherry picked from commit bcdda15a40)
2026-07-26 20:19:22 +02:00
Dustin L. Howett ffc1114f84 Merge pull request #3253 from datauwu/tar-fix-oob
(cherry picked from commit c16162083a)
2026-07-26 20:19:09 +02:00
Dustin L. Howett 2de73db12b Merge pull request #3255 from datauwu/iso9660-fix-oob-read
(cherry picked from commit dbb4e7f28d)
2026-07-26 20:19:02 +02:00
Dustin L. Howett 86e60964f5 Merge pull request #3236 from uchiha-bug-hunter/acl-from-text-nl-overread
acl: fix over-read on empty field in archive_acl_from_text_nl
(cherry picked from commit 51060e492b)
2026-07-26 20:18:49 +02:00
Tim Kientzle e8f39f1516 Merge pull request #3250 from datauwu/tar-avoid-redundant-size
tar: avoid redundant Solaris ACL size parsing
(cherry picked from commit f4786afb10)
2026-07-26 20:18:41 +02:00
Tim Kientzle 22ffe8e8e4 Merge pull request #3252 from datauwu/tar-fix-oob-read
tar: fix 1-byte OOB read in SUN.holesdata parsing
(cherry picked from commit d81b9f5582)
2026-07-26 20:18:36 +02:00
Dustin L. Howett a5a6785ffb Merge pull request #3246 from stoeckmann/cab_style
cab: Extend Huffman documentation
(cherry picked from commit f0b9700384)
2026-07-26 20:18:15 +02:00
Dustin L. Howett 7920c04f99 Merge pull request #3244 from datauwu/warc-fix-write-past
(cherry picked from commit 7b635176c5)
2026-07-26 20:18:11 +02:00
Tim Kientzle 5e09594094 Merge pull request #3245 from kientzle/kientzle-archive-read-failed-header-recovery
[Read core] Allow format handlers to FAIL a header read

(cherry picked from commit f2f3eb9f50)
2026-07-26 20:17:47 +02:00
Tim Kientzle 3de8f12efd Merge pull request #3242 from datauwu/zip-basic-support-0x000d
zip: read PKWARE Unix extra field metadata
(cherry picked from commit f7965ac947)
2026-07-26 20:17:39 +02:00
Tim Kientzle 69e9ab7548 Merge pull request #3240 from kientzle/kientzle-zip-uncompressed-size-exact-check
[Zip] Reject archives if the 32-bit size field is not correct

(cherry picked from commit d21fdc9f84)
2026-07-26 20:17:25 +02:00
Dustin L. Howett 398569dfc7 Merge pull request #3232 from kientzle/kientzle-read-data-into-fd-size-boundary
[Write] Truncate write-to-fd at the declared entry size

(cherry picked from commit 3c3ec69d44)
2026-07-26 20:17:16 +02:00
Dustin L. Howett 4e7c55e73a Merge pull request #3219 from DHowett/custom-clang-in-ci
ci: add a new Lint step that uses a custom-built linter
(cherry picked from commit afc33dfeb4)
2026-07-26 20:17:09 +02:00
Dustin L. Howett e25f689b12 Merge pull request #3237 from datauwu/tar-avoid-redundant-mode
tar: avoid redundant mode parsing

(cherry picked from commit 3151a76b1e)
2026-07-26 20:17:04 +02:00
Dustin L. Howett 165edb3611 Merge pull request #3233 from stoeckmann/archive_entry_new2
Check `archive_entry_new2` return value

(cherry picked from commit cebab49b99)
2026-07-26 20:16:59 +02:00
Dustin L. Howett e067c7884f Merge pull request #3234 from stoeckmann/raw_oflow
raw: Properly treat huge inputs
(cherry picked from commit 0cb18445d3)
2026-07-26 20:16:54 +02:00
Dustin L. Howett 01d1c12ce8 Merge commit '25ef914386252adbf67d07d6c5bf018dfcbe34a9' as 'build/la-lint'
(cherry picked from commit 942984fd7d)
2026-07-26 20:16:41 +02:00
Dustin L. Howett 5e87e36637 Merge pull request #3239 from datauwu/warc-require-size
(cherry picked from commit 4767d73519)
2026-07-26 20:16:30 +02:00
Tim Kientzle 710f837b31 Merge pull request #3238 from stoeckmann/cpio_ioflow
cpio: Prevent signed integer overflow
(cherry picked from commit f66b4c7f8f)
2026-07-26 20:16:22 +02:00
Tobias Stoeckmann 858509c392 Merge pull request #3231 from datauwu/7zip-skip-archiveproperties
7zip: skip ArchiveProperties payload data
(cherry picked from commit 41a72e5553)
2026-07-26 20:15:46 +02:00
Tim Kientzle e378a5bb09 Merge pull request #3230 from kientzle/kientzle-zip-reject-overlong-bodies
[Zip] Reject entries with overlong bodies

(cherry picked from commit 5a2ec45b9c)
2026-07-26 20:15:25 +02:00
Dustin L. Howett 79ec62a5c1 Merge pull request #3229 from stoeckmann/cab_e8
(cherry picked from commit 5933c80ae5)
2026-07-26 20:15:13 +02:00
Tim Kientzle 4bb52f4934 Merge pull request #3228 from datauwu/zip-encrypted-int-overflow
zip: avoid signed overflow in encrypted size checks
(cherry picked from commit 47999c275f)
2026-07-26 20:15:09 +02:00
Dustin L. Howett 2c9e5b41b8 Merge pull request #3208 from datauwu/7zip-skip-defined-bitmaps
(cherry picked from commit 42b2444920)
2026-07-26 20:15:00 +02:00
Dustin L. Howett 2049eed5fd Merge pull request #3224 from datauwu/formats-remove-unused-state
formats: remove unused states from 7 formats
(cherry picked from commit 1162aaeccb)
2026-07-26 20:14:54 +02:00
Dustin L. Howett c18d2aa7eb Merge pull request #3226 from uchiha-bug-hunter/pathmatch-wide-bracket-overread
pathmatch: fix wide-char bracket over-read in pm_w
(cherry picked from commit 6c97b0ae54)
2026-07-26 20:14:47 +02:00
Dustin L. Howett 7231e54e22 Merge pull request #3206 from DHowett/win32-symlink-bypass
(cherry picked from commit 0c856d3a8f)
2026-07-26 20:14:36 +02:00
Dustin L. Howett 1cafc7ab96 Merge pull request #3221 from stoeckmann/callback_data_check
(cherry picked from commit 52bf591c1a)
2026-07-26 20:14:30 +02:00
Dustin L. Howett 97b636b573 Merge pull request #3216 from setarcos/loongarch
test: fix incorrect hole count reporting on loongarch64
(cherry picked from commit 983f8da4be)
2026-07-26 20:14:17 +02:00
Dustin L. Howett bca61a0d8d Merge pull request #3217 from datauwu/7zip-simplify-bool-handling
7zip: simplify bool handling
(cherry picked from commit 0b661a91be)
2026-07-26 20:14:13 +02:00
Dustin L. Howett d598dc1ce5 Merge pull request #3218 from datauwu/7zip-redundant-bcj-assign
7zip: drop redundant BCJ2 assignments
(cherry picked from commit d586479a72)
2026-07-26 20:14:08 +02:00
Dustin L. Howett 8fff248d1d Merge pull request #3213 from datauwu/7zip-remove-unused-state
(cherry picked from commit 769b628019)
2026-07-26 20:13:56 +02:00
Dustin L. Howett 1c4887075f Merge pull request #3212 from stoeckmann/cab_doc_types
cab: Improve LZX translation readability
(cherry picked from commit 4191fecb3a)
2026-07-26 20:13:48 +02:00
Dustin L. Howett dedf6d53d9 Merge pull request #3207 from datauwu/tests-merge-fix-typo
tests: merge tests and fix misleading labels
(cherry picked from commit f59675ccff)
2026-07-26 20:13:33 +02:00
Dustin L. Howett 1bd53b6538 Merge pull request #3209 from datauwu/7zip-fix-sfx-boundary
7zip: fix SFX boundary checks
(cherry picked from commit d05e842435)
2026-07-26 20:13:26 +02:00
Dustin L. Howett 72455fd3e2 Merge commit from fork
windows: fix a number of symlink handling issues and enable tests
(cherry picked from commit 9046e753ca)
2026-07-26 20:13:15 +02:00
Tobias Stoeckmann 964ce8e56d Merge pull request #3205 from DHowett/assert-mem-obo
Fix two more off-by-ones calling assertEqualMem

(cherry picked from commit ab4f2a57e9)
2026-07-26 20:13:06 +02:00
Dustin L. Howett d0ed63767b Merge pull request #3204 from stoeckmann/cab_oob_handling
(cherry picked from commit e0c4bccd8e)
2026-07-26 20:13:00 +02:00
Dustin L. Howett 1fddbd35b0 Merge pull request #3200 from datauwu/zip-fix-compare-full-contents
zip: compare full file3 contents in tests
(cherry picked from commit 4e6e6619eb)
2026-07-26 20:12:51 +02:00
Dustin L. Howett 59af731d48 Merge pull request #3199 from datauwu/7zip-redundant-header-checks
7zip: remove redundant read header checks
(cherry picked from commit 573de88e1c)
2026-07-26 20:12:47 +02:00
Dustin L. Howett d40539efcf Merge pull request #3201 from datauwu/tests-fix-charset-labels
tests: fix incorrect charset labels
(cherry picked from commit 1e1d478486)
2026-07-26 20:12:41 +02:00
Dustin L. Howett 6aa75f6954 Merge pull request #3203 from libarchive/dependabot/github_actions/all-actions-fc272564ab
CI: Bump acj/freebsd-firecracker-action from 0.10.0 to 0.10.1 in the all-actions group
(cherry picked from commit aa1dbe602a)
2026-07-26 20:12:26 +02:00
Dustin L. Howett 752c9718f9 Merge pull request #3187 from nvmb3r/rar5-unpacked-size-limit
rar5: reject streams that exceed the declared unpacked size
(cherry picked from commit 588363eb4e)
2026-07-26 20:12:17 +02:00
Dustin L. Howett 362ddea377 Merge pull request #3194 from uchiha-bug-hunter/iso9660-zf-oob-read
iso9660: fix OOB read in parse_rockridge_ZF1 on short ZF entry
(cherry picked from commit 354a3535ed)
2026-07-26 20:12:06 +02:00
Dustin L. Howett 90615cab56 Merge pull request #3192 from stoeckmann/ar_integers
(cherry picked from commit 401a1915cf)
2026-07-26 20:11:55 +02:00
Dustin L. Howett 74d4393c16 Merge pull request #3197 from stoeckmann/mtree_cast
mtree: Fix integer overflow on 32 bit systems
(cherry picked from commit b5aceb5887)
2026-07-26 20:11:42 +02:00
Dustin L. Howett 06c0762b3f Merge pull request #3196 from datauwu/7zip-redundant-per-entry-setup
(cherry picked from commit a1b0e83464)
2026-07-26 20:11:33 +02:00
Dustin L. Howett a45a165b24 Merge pull request #3193 from datauwu/zip-harden-test-cleanup-assertion
(cherry picked from commit dbc3b336a5)
2026-07-26 20:11:29 +02:00
Dustin L. Howett 43c3528b00 Merge pull request #3191 from stoeckmann/xattr_malloc
(cherry picked from commit 25ea451941)
2026-07-26 20:11:20 +02:00
Tim Kientzle e6f56172de Merge pull request #3188 from cyphercodes/fix-3151-empty-pax-headers
Reject empty pax extended headers

(cherry picked from commit 82c0149234)
2026-07-26 20:10:51 +02:00
Tobias Stoeckmann 4a047f022e Merge pull request #3185 from stoeckmann/7zip_integers
7zip: Improve integer handling
(cherry picked from commit b1677ddb92)
2026-07-26 20:10:35 +02:00
Tobias Stoeckmann 9cc3e46314 Merge pull request #3167 from stoeckmann/unzip_windows
unzip: Add Windows port
(cherry picked from commit 4558c310de)
2026-07-26 20:10:30 +02:00
Dustin L. Howett cc711d6a7f Merge pull request #3181 from uchiha-bug-hunter/xar-atou64-overread
(cherry picked from commit 1a778f9c10)
2026-07-26 20:10:15 +02:00
Dustin L. Howett 5b98234fa4 Merge pull request #3183 from uchiha-bug-hunter/gnutar-gname-overflow
(cherry picked from commit 414e4e05ca)
2026-07-26 20:10:09 +02:00
Dustin L. Howett 5805ff64a8 Merge pull request #3182 from bluca/seek_issue
read_data_into_fd: Fix spurious "Seek error" for trailing holes

(cherry picked from commit 42d9794ec5)
2026-07-26 20:10:00 +02:00
Dustin L. Howett 9f2e97e961 Merge pull request #3180 from dag-erling/des/3.8.8-fixes
Miscellaneous fixes for 3.8.8

* configure.ac: Remove unused checks
* libarchive: Fix `TIME_MAX` and `TIME_MIN`
* test: Fix off-by-one in bounds check
  Fixes:                0e4fa9ff0d ("test: promote the win32-repairing systemf wrapper to all systemf calls")
* bsdunzip_test: Set umask before asserting permissions
  Fixes:                34b3da0013 ("unzip: Add symlink tests")
* archive_write_disk_posix: Fix type issues
  Fix type issues in the HFS+ (de)compression code, primarily to avoid
  arithmetic overflow when calculating the block count during compression.
* archive_write_disk_posix: Miscellaneous cleanup
  Use `S_IS*()` macros consistently and clean up some `#ifdef`s.
* archive_write_disk_posix: Symlinks can have AppleDouble data
* libarchive: Fix format string issues

(cherry picked from commit bad51bcc8d)
2026-07-26 20:09:51 +02:00
Dustin L. Howett 638f3f9502 Merge pull request #3177 from DHowett/zisofs-creation-size
(cherry picked from commit 7633fd475e)
2026-07-26 20:09:43 +02:00
Dustin L. Howett 9920171ba7 Merge pull request #3160 from GeorgH93/fix_zipx_streaming_non_seekable
Fix zipx reading with ZIP_LENGTH_AT_END flag from non-seekable source

(cherry picked from commit 6b468d68d1)
2026-07-26 20:09:05 +02:00
Tim Kientzle 5aeb66ad30 Merge pull request #3175 from uchiha-bug-hunter/xar-base64-oob-read
xar: fix OOB read decoding odd-length base64 in strappend_base64
(cherry picked from commit 6f85565e42)
2026-07-26 20:08:58 +02:00
Tim Kientzle 31c306d809 Merge pull request #3178 from uchiha-bug-hunter/unzip-pathname-dotdot
unzip: reject bare '..' and trailing '/..' in pathname_is_insecure
(cherry picked from commit 94daafd6fb)
2026-07-26 20:08:44 +02:00
Tobias Stoeckmann 3e38adf102 Merge commit from fork
unzip: reject absolute or traversing symlink targets
(cherry picked from commit 9bd1a06adb)
2026-07-26 20:08:06 +02:00
Dustin L. Howett d70c3e24e0 Merge pull request #3162 from soda0289/add-windows-long-path-manifest
tar: mark bsdtar as long-path aware on Windows

tar -C/--directory option calls SetCurrentDirectoryW(), which is limited to MAX_PATH (260) characters unless the process opts in to longpath support via an application manifest and enables a registry setting or sets an option in developer settings.

(cherry picked from commit c0e779b73c)
2026-07-26 19:41:06 +02:00
Tobias Stoeckmann 1e363054d8 Merge pull request #3176 from stoeckmann/unzip_tests
unzip: Extend test suite
(cherry picked from commit df13c97c45)
2026-07-26 19:40:58 +02:00
Martin Matuska 7219b0134d Release 3.8.8 2026-06-23 11:11:31 +02:00
Martin Matuška 56f3f5fa0a Merge pull request #3171 from libarchive/dependabot/github_actions/all-actions-2217aebe03
CI: Bump actions/checkout from 6.0.3 to 7.0.0 in the all-actions group
(cherry picked from commit 2b9cacf6e8)
2026-06-23 11:08:08 +02:00
Martin Matuška 22a288834e Merge pull request #3172 from stoeckmann/lafe_fnmatch
libarchive_fe: Import FreeBSD's fnmatch

(cherry picked from commit 9819bc9370)
2026-06-23 11:08:04 +02:00
Dustin L. Howett 185a465e39 Merge pull request #3168 from uchiha-bug-hunter/cpio-write-pathlength-oob
cpio: fix OOB read from int pathlength truncation in newc/binary writers
(cherry picked from commit c55c66b507)
2026-06-23 11:07:51 +02:00
Tobias Stoeckmann 574c11ab3f Merge pull request #3166 from stoeckmann/unzip_p_enc_test
unzip: Skip another test if zlib unavailable
(cherry picked from commit c56456886d)
2026-06-23 11:07:23 +02:00
Dustin L. Howett f4784e6a1d Merge pull request #3164 from stoeckmann/iso9660_realloc
(cherry picked from commit 29657bc0c3)
2026-06-23 11:07:14 +02:00
Dustin L. Howett 529ca8ef52 Merge pull request #3165 from stoeckmann/error_zero
Do not set 0 as error code, since this will be printed as success. Use proper error codes in various places for better error messages.

(cherry picked from commit cafc7f7156)
2026-06-23 11:07:07 +02:00
Martin Matuška be3df30fd2 Merge pull request #2918 from aale24/fix-test-format-newc-race
Fix test_format_newc timestamp race condition

(cherry picked from commit ba387256e0)
2026-06-23 11:06:58 +02:00
Tobias Stoeckmann 1b38a23a53 Merge pull request #3158 from stoeckmann/cpio_write
cpio: Fix writer OOB read with very long filenames
(cherry picked from commit 042501f89c)
2026-06-23 11:06:51 +02:00
Martin Matuška 2fc792ba8f Merge pull request #3159 from stoeckmann/ckd_size
Use checked size_t arithmetic

(cherry picked from commit 2498165482)
2026-06-23 11:06:46 +02:00
Dustin L. Howett fcb6f38647 Merge pull request #3135 from stoeckmann/read_ahead_format
formats: Simplify `__archive_read_ahead` use
(cherry picked from commit 22e1240357)
2026-06-23 11:06:42 +02:00
Martin Matuška 35e4a6edc3 Merge pull request #3157 from libarchive/dependabot/github_actions/all-actions-0a5d8bb8fa
CI: Bump the all-actions group across 1 directory with 5 updates
(cherry picked from commit ead081b704)
2026-06-23 11:06:34 +02:00
Martin Matuška a61b1fe618 Merge pull request #3150 from DHowett/ci/windows-package-dependencies
build: windows: get all CI dependencies from a package manager
(cherry picked from commit fc0530d502)
2026-06-23 11:06:30 +02:00
Martin Matuška e90bccd387 Merge pull request #3144 from stoeckmann/cab_truncation
cab: Improve truncation detection
(cherry picked from commit 26f68fcc6d)
2026-06-23 11:06:14 +02:00
Martin Matuška fb76871b3f Merge pull request #3134 from stoeckmann/archive_integer
Introduce `archive_integer.h` for checked arithmetic

(cherry picked from commit f6dea9e94b)
2026-06-23 11:06:08 +02:00
Tobias Stoeckmann 748abda567 Merge pull request #3145 from stoeckmann/cab_max_namelen
cab: Properly limit maximum name length
(cherry picked from commit 8510878d38)
2026-06-23 11:06:03 +02:00
Dustin L. Howett 5e2a2977ad Merge pull request #3153 from stoeckmann/cab_multi
cab: Fix multi volume parser
(cherry picked from commit 5e566cf0c6)
2026-06-23 11:05:59 +02:00
Dustin L. Howett 3f6d7526d7 Merge pull request #3142 from datauwu/tar-avoid-wcs-slash-check
tar: avoid wide pathname conversion for trailing slash check
(cherry picked from commit d3d511ca9e)
2026-06-23 11:05:53 +02:00
Dustin L. Howett 0739756be8 Merge pull request #3148 from XananasX7/ci/pin-actions
ci: pin acj/freebsd-firecracker-action to full commit SHA
(cherry picked from commit d5a1026aea)
2026-06-23 11:05:39 +02:00
Dustin L. Howett 39d41e262d Merge pull request #3149 from DHowett/fix-mingw-tests
(cherry picked from commit 1bf2b2ac3f)
2026-06-23 11:05:36 +02:00
Dustin L. Howett 267daea124 Merge pull request #3143 from stoeckmann/7zip_size_int64
7zip: Avoid unnecessary int64_t size_t casts
(cherry picked from commit 7a35e71786)
2026-06-23 11:05:29 +02:00
Dustin L. Howett 463db52e93 Merge pull request #3146 from stoeckmann/size_t_off
read_disk: Check if off_t can overflow size_t

(cherry picked from commit 99d695c0d3)
2026-06-23 11:05:22 +02:00
Dustin L. Howett 2b3dfbe488 Merge pull request #3138 from datauwu/tar-ustar-pathname-fastpath
(cherry picked from commit fdd53e2c23)
2026-06-23 11:03:49 +02:00
Tobias Stoeckmann 94a229e3f7 Merge pull request #3140 from DHowett/dh/write-free-1
test: remove one new instance of assertEqualIntA(...free...)
(cherry picked from commit 42c656a3f9)
2026-06-23 11:03:41 +02:00
Dustin L. Howett 464b9d4b12 Merge pull request #2865 from GeorgH93/read_zipx_encryption
Add support for reading encrypted zipx formats (bzip2, lzma, ppmd, xz, zstd)

(cherry picked from commit b66d136b70)
2026-06-23 11:03:36 +02:00
Tobias Stoeckmann e50a851672 Merge pull request #2923 from bililateral/pr-7zip-numfiles-oom
7zip: sanity-check FilesInfo NumFiles before allocating entries
(cherry picked from commit 10bd4da47b)
2026-06-23 11:02:59 +02:00
Dustin L. Howett f853b23370 Merge pull request #3105 from i1011/rar-unbounded-staticdata-fix
rar: Add missing bound check for staticdata
(cherry picked from commit c09f7b044b)
2026-06-23 11:02:54 +02:00
Dustin L. Howett 46829fce10 Merge pull request #3137 from stoeckmann/typos_style
Fix minor non-functional issues

(cherry picked from commit 727be2f1a5)
2026-06-23 11:02:45 +02:00
Dustin L. Howett fd468f8967 Merge pull request #3136 from stoeckmann/counters
Remove unneeded counters

(cherry picked from commit 5a7d75f3e6)
2026-06-23 11:02:37 +02:00
Dustin L. Howett d62c81372e Merge pull request #3048 from legnaleurc/fix/rar-reset-lz-table
rar: reset low-distance state for new LZ tables
(cherry picked from commit bede9a3692)
2026-06-23 11:02:24 +02:00
Dustin L. Howett 7cbf4a8817 Merge pull request #3047 from legnaleurc/fix/rar-recovery-record
rar: skip NEWSUB payloads without size cap
(cherry picked from commit 82404ac239)
2026-06-23 11:02:20 +02:00
Dustin L. Howett b9cf20973f 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).

(cherry picked from commit 1b2af5a7a8)
2026-06-23 11:02:16 +02:00
Dustin L. Howett b551ba7f20 Merge pull request #3034 from datauwu/master
(cherry picked from commit ea5c8fff0b)
2026-06-23 11:02:05 +02:00
Dustin L. Howett bd89392bb8 Merge pull request #2954 from ShelpAm/master
fix: zstd not found on Windows
(cherry picked from commit 81385b8864)
2026-06-23 11:02:02 +02:00
Martin Matuška c11e709cf4 Merge pull request #2967 from bgilbert/deflate
Fix `test_write_filter_gzip` on Ubuntu s390x

(cherry picked from commit 983e1edcdd)
2026-06-23 11:01:41 +02:00
Martin Matuška 160540487d Merge pull request #3131 from stoeckmann/rpm_fsm
rpm: Refactor filter
(cherry picked from commit 65eaff4835)
2026-06-23 11:01:36 +02:00
Martin Matuška aa622bfdf4 Merge pull request #3128 from stoeckmann/into_fd
Improve `archive_read_data_into_fd` with sparse files

(cherry picked from commit 5f8f651fae)
2026-06-23 11:01:31 +02:00
Martin Matuška a07fbdb415 Merge pull request #3121 from stoeckmann/rar5_bytes_remaining
rar5: fix signed integer underflow in bytes_remaining
(cherry picked from commit d9279e464c)
2026-06-23 11:01:25 +02:00
Martin Matuška b64ebd5ae7 Merge pull request #3120 from stoeckmann/archive_endian
Extend `archive_endian.h` usage

(cherry picked from commit b3da16bbf2)
2026-06-23 11:01:15 +02:00
Martin Matuška 6e9aa8a57e Merge pull request #3098 from stoeckmann/filter_read_ahead
filters: Simplify `__archive_read_filter_ahead` use
(cherry picked from commit a116558eb4)
2026-06-23 11:01:09 +02:00
Martin Matuška 5b50da71a4 Merge pull request #3119 from stoeckmann/7zip_u32_oflow
7zip: Fix range check in get_pe_sfx_offset
(cherry picked from commit f7ec3a2505)
2026-06-23 11:01:05 +02:00
Martin Matuška 17464ecdb9 Merge pull request #3115 from stoeckmann/gzip_writer_mem
gzip: Fix OOB in writer with huge filename
(cherry picked from commit 792c87d5bd)
2026-06-23 11:00:58 +02:00
Martin Matuška 390dd137a4 Merge pull request #3114 from stoeckmann/open_oob
Fix OOB in `archive_read_open_filenames_w` on some systems

(cherry picked from commit 7957d6d3b0)
2026-06-23 11:00:53 +02:00
Martin Matuška e150c2f417 Merge pull request #3113 from stoeckmann/fflags_strcpy
7zip/rar5: Simplify file attribute handling

(cherry picked from commit 5ce5112087)
2026-06-23 11:00:43 +02:00
Martin Matuška c93ad88df8 Merge pull request #3108 from stoeckmann/windows_legacy
Reduce Windows legacy support

(cherry picked from commit 5c516433ee)
2026-06-23 11:00:39 +02:00
Dustin L. Howett 95310a785d 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

(cherry picked from commit 06e296c729)
2026-06-23 11:00:33 +02:00
Dustin L. Howett c560efe9c6 Merge pull request #3021 from chnzzh/fix/iso9660-ce-loop
iso9660: fix infinite loop on self-referencing CE entry
(cherry picked from commit e501d52c74)
2026-06-23 11:00:28 +02:00
Dustin L. Howett fc5545731a Merge pull request #3127 from shxz9u/fix-callback-data-realloc
Avoid updating allocation state before realloc succeeds

(cherry picked from commit e78c98d896)
2026-06-23 11:00:24 +02:00
Dustin L. Howett 75240a3c4b Merge pull request #3126 from stoeckmann/shar
shar: Check `archive_entry_clone` result
(cherry picked from commit a9a9039866)
2026-06-23 11:00:19 +02:00
Dustin L. Howett 47926b95a9 Merge pull request #3125 from stoeckmann/disk_clone
Check allocation in `_archive_write_disk_header`

(cherry picked from commit 2b21f5a6cc)
2026-06-23 11:00:15 +02:00
Dustin L. Howett 5eb060231f Merge pull request #3124 from stoeckmann/entry_mem
entry_link_resolver: Improve memory handling

(cherry picked from commit 5335a4ed97)
2026-06-23 11:00:11 +02:00
Dustin L. Howett 276c750ae5 Merge pull request #3123 from stoeckmann/cab_remaining
cab: Simplify `cab_read_ahead_remaining`
(cherry picked from commit 1a248e3a36)
2026-06-23 11:00:07 +02:00
Dustin L. Howett 3acfad096a Merge pull request #3122 from stoeckmann/into_buffer
Remove `archive_read_data_into_buffer` comment

(cherry picked from commit 53f2275bf0)
2026-06-23 11:00:03 +02:00
Dustin L. Howett 86762e4164 Merge pull request #3117 from i1011/iso9660-null-deref-fix
iso9660: Fix null dereference in set_directory_record_rr
(cherry picked from commit aff2e9d8d9)
2026-06-23 10:59:51 +02:00
Dustin L. Howett 7621c6d489 Merge pull request #3039 from dnelson-1901/manpage-fixes
(cherry picked from commit cda40b999b)
2026-06-23 10:59:22 +02:00
Dustin L. Howett 2453823de6 Merge pull request #3109 from stoeckmann/windows_concurrency
(cherry picked from commit 5c920c88f4)
2026-06-23 10:59:19 +02:00
Dustin L. Howett fec46643b8 Merge pull request #3112 from stoeckmann/windows_partition
(cherry picked from commit cc85a2cdf0)
2026-06-23 10:59:13 +02:00
Tim Kientzle a83750fb4a Merge pull request #3106 from stoeckmann/precompute_tables
Precompute static tables

(cherry picked from commit bf268f086d)
2026-06-23 10:59:09 +02:00
Tim Kientzle f808beece5 Merge pull request #3107 from stoeckmann/dynamic
Turn static state variables dynamic

(cherry picked from commit e48b9c4cf4)
2026-06-23 10:59:05 +02:00
Tim Kientzle 444e2cce4d Merge pull request #3110 from stoeckmann/static_style
Turn two static tables `static const`

(cherry picked from commit b660b6965c)
2026-06-23 10:58:58 +02:00
Tim Kientzle 9bd439a65a Merge pull request #3111 from stoeckmann/tests_assert_a
tests: Use assertEqualInt for archive_write_free
(cherry picked from commit 6895434b64)
2026-06-23 10:58:54 +02:00
Martin Matuška 6a129f58e9 Merge pull request #3045 from datauwu/iso9660-joliet-patch
iso9660: bound duplicate identifier extension placement
(cherry picked from commit 1b080e9c2a)
2026-06-23 10:58:31 +02:00
Martin Matuška e91dffdc92 Merge pull request #3073 from stoeckmann/lz4_zstd_32
lz4/zstd: Fix 32 bit platform endless loop and OOB access during bidding

(cherry picked from commit 6ac02f9521)
2026-06-23 10:58:26 +02:00
Martin Matuška 71f6b7c1d8 Merge pull request #3091 from yPin9/fix/rar5-consume-remaining
rar5: skip unconsumed block bytes before ARCHIVE_RETRY
(cherry picked from commit 9b5c25087e)
2026-06-23 10:58:18 +02:00
Martin Matuška b4ff77b25e Merge pull request #3103 from stoeckmann/uu_32_oob
uu: Extend range checks to avoid 32 bit OOB
(cherry picked from commit 85ea76b373)
2026-06-23 10:58:13 +02:00
Martin Matuška f8588d3447 Merge pull request #2837 from mmatuska/ci-firecracker
CI: add FreeBSD 15 build via firecracker VM to GitHub Actions
(cherry picked from commit 93065aac92)
2026-06-23 10:58:07 +02:00
Tobias Stoeckmann bb22f7308b Merge pull request #3081 from stoeckmann/tests_i686_asan
tests: Skip checks on low memory systems
(cherry picked from commit f1b6650c67)
2026-06-23 10:58:03 +02:00
Tobias Stoeckmann 9c69ca2322 Merge pull request #3104 from stoeckmann/uu_cleanup
uu: Minor code cleanups
(cherry picked from commit 1e0736a92e)
2026-06-23 10:57:58 +02:00
Dustin L. Howett 53cbe1116e 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.

(cherry picked from commit 17b4395a15)
2026-06-23 10:57:48 +02:00
Dustin L. Howett 54c8f1a66b 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>
(cherry picked from commit 49b9383800)
2026-06-23 10:57:44 +02:00
Dustin L. Howett 859de0dc44 Merge pull request #3090 from DHowett/ci/cygwin
ci: migrate Windows Cygwin to GitHub Actions
(cherry picked from commit 4a18b9a4b5)
2026-06-23 10:57:40 +02:00
Dustin L. Howett 321c6458fc Merge pull request #3094 from i1011/xar-redundant-dec-fix
(cherry picked from commit 5ddb5efce1)
2026-06-23 10:57:20 +02:00
Martin Matuška d98369b4e1 Merge pull request #3089 from mostynb/remove_cirrus_ci
Remove Cirrus CI setup, it is shutting down in a few days

(cherry picked from commit ebfa344055)
2026-06-23 10:57:00 +02:00
Martin Matuška c52da38579 Merge pull request #3093 from stoeckmann/lz4_skip
lz4: Improve truncated input stream detection
(cherry picked from commit 66026841b2)
2026-06-23 10:56:56 +02:00
Martin Matuška 0332996f6f Merge pull request #3095 from stoeckmann/afio_header
cpio: Improve afio header detection
(cherry picked from commit 36d69b3ec8)
2026-06-23 10:56:53 +02:00
Martin Matuška 2fe2828581 Merge pull request #3096 from stoeckmann/filters_comments
filters: Update comments
(cherry picked from commit fcbbce329c)
2026-06-23 10:56:48 +02:00
Martin Matuška 2e97ccd3e5 Merge pull request #3097 from stoeckmann/typos
Fix typos in comments and error message

(cherry picked from commit 05eff7d2da)
2026-06-23 10:56:44 +02:00
Martin Matuška e5acfbd88e Merge pull request #3099 from stoeckmann/7zip_seek
7zip: Extend support for filtered input
(cherry picked from commit 0ebc440d8e)
2026-06-23 10:56:40 +02:00
Martin Matuška 706e2b6783 Merge pull request #3100 from stoeckmann/lz4_xxh32
lz4: Check `XXH32_init` result
(cherry picked from commit bb0d9dfd39)
2026-06-23 10:56:35 +02:00
Dustin L. Howett f0bf39bc0c Merge pull request #3088 from mostynb/improve_bsdtar_subst_error_messages
tar: Improve -s Invalid replacement string error messages
(cherry picked from commit 6a8af66e64)
2026-06-23 10:56:22 +02:00
Tobias Stoeckmann 11228c9936 Merge pull request #3085 from stoeckmann/gzip_check
gzip: Support more large in-memory archives
(cherry picked from commit 3b6b10e7e2)
2026-06-23 10:56:12 +02:00
Tim Kientzle 4edf47d84a Merge pull request #3092 from vmihalis/https-config-fetch
build: fetch config.guess/config.sub over HTTPS
(cherry picked from commit a70de97aab)
2026-06-23 10:56:08 +02:00
Dustin L. Howett 2338f9af99 Merge pull request #3079 from i1011/win-ci-missing-errcheck-fix
CI: Add missing exit on error in windows CI
(cherry picked from commit 2ef07fe0d1)
2026-06-23 10:55:53 +02:00
Dustin L. Howett 8ccf280b25 Merge pull request #3087 from stoeckmann/cygwin_rar
rar: Simplify FILE_ATTRIBUTE_DIRECTORY check
(cherry picked from commit 7858c8cbf5)
2026-06-23 10:55:48 +02:00
Tobias Stoeckmann 8c61c9faff Merge pull request #3083 from stoeckmann/read_int_overflow
Fix integer overflow in __archive_read_filter_ahead

(cherry picked from commit d5053c3512)
2026-06-23 10:55:40 +02:00
Tobias Stoeckmann 63e6571485 Merge pull request #3084 from stoeckmann/filters_total_out
Drop total_out tracking from read filters

(cherry picked from commit e1efb9a7eb)
2026-06-23 10:55:33 +02:00
Tobias Stoeckmann 35e721b390 Merge pull request #3080 from stoeckmann/tests_skip
tests: Fix memory leaks when skipping
(cherry picked from commit d6654b4e01)
2026-06-23 10:55:28 +02:00
Tim Kientzle 7c381879c9 Merge pull request #3061 from tosanjay/warc-header-popul-ehdr-leak
warc writer: free hdr on _popul_ehdr overflow in _warc_header

(cherry picked from commit c15997d4f3)
2026-06-23 10:55:21 +02:00
Tim Kientzle bb6abdbefb Merge pull request #3078 from vlmarek/solaris-skip-string-conversion-fail-tests
Skip tests where Solaris iconv substitutes invalid chars

(cherry picked from commit 43a5035657)
2026-06-23 10:55:17 +02:00
Dustin L. Howett 1400d2d19d Merge pull request #3067 from fdegros/fix-7z-seek-null-error
7-Zip: Set error message in case of error
(cherry picked from commit b4d8c89bfa)
2026-06-23 10:55:13 +02:00
Tobias Stoeckmann 382f9df322 Merge pull request #3077 from stoeckmann/32build
32 bit: Fix compile warnings and test failure

(cherry picked from commit cd61f4cc59)
2026-06-23 10:54:59 +02:00
Dustin L. Howett b0b9eff5bb Merge pull request #3049 from KongQBin/master
build: fix global state leakage in crypto/library checks
(cherry picked from commit 7235ae8714)
2026-06-23 10:54:53 +02:00
Dustin L. Howett ae40147eb7 Merge pull request #3075 from stoeckmann/tests_close
tests: Use assertEqualIntA for archive_*_close
(cherry picked from commit d59e51f97b)
2026-06-23 10:54:49 +02:00
Tobias Stoeckmann 20f4bd471e Merge pull request #2972 from stoeckmann/rr_moved
iso9660: Add test for #2978
(cherry picked from commit a662e108f2)
2026-06-23 10:54:41 +02:00
Dustin L. Howett 78846739ce 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: 16ad931073 ("cpio reader: Validate pathname in record_hardlink")

Resolves #3053.

(cherry picked from commit c03931678b)
2026-06-23 10:54:36 +02:00
Tobias Stoeckmann 6ab40e6582 Merge pull request #3050 from stoeckmann/bzip2_large
bzip2: Support large in-memory archives
(cherry picked from commit 8b56378deb)
2026-06-23 10:54:29 +02:00
Tobias Stoeckmann 39865bf3b9 Merge pull request #3072 from stoeckmann/tests_free
tests: Avoid assertEqualIntA with archive_*_free
(cherry picked from commit 5c8a084f9d)
2026-06-23 10:54:16 +02:00
Tobias Stoeckmann 03125f866f Merge commit from fork
read: Fix memory corruption on filtered multi-volume archives
(cherry picked from commit 68b69249de)
2026-06-23 10:53:47 +02:00
Tobias Stoeckmann 5bc5b344bb Merge pull request #3074 from stoeckmann/7zip_stream
7zip: Support streamable reading again
(cherry picked from commit 531d70f88c)
2026-06-23 10:31:32 +02:00
Dustin L. Howett 9fd63f8920 Merge pull request #2790 from LumioseSil/SetFilePointerEx_perso
Replace SetFilePointerEx_perso (local reimplementation) with SetFilePointerEx,
as we no longer need to support Windows XP

(cherry picked from commit 4db7955782)
2026-06-23 10:31:16 +02:00
Dustin L. Howett 8bfc533f21 Merge pull request #3062 from tosanjay/7zip-file-new-utf16name-leak
7zip writer: free file->utf16name on symlink UTF-8 conversion failure

(cherry picked from commit d86214bfbb)
2026-06-23 10:31:12 +02:00
Dustin L. Howett b3045fd830 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

(cherry picked from commit ea7084a735)
2026-06-23 10:31:08 +02:00
Dustin L. Howett f774f03b40 Merge pull request #3071 from stoeckmann/rar5_doublefree
rar5: Avoid dangling pointers in init_unpack
(cherry picked from commit 42453cf162)
2026-06-23 10:31:03 +02:00
Dustin L. Howett d58dce976c Merge pull request #3064 from i1011/version-details-fix
Fix libattr version returned in archive_version_details, as well as a leak.

(cherry picked from commit b8a7b027f8)
2026-06-23 10:30:58 +02:00
Tobias Stoeckmann 4ab0986eeb Merge pull request #3051 from stoeckmann/compress_debug
compress: Remove harmful "dead" code
(cherry picked from commit e20a0b2136)
2026-06-23 10:30:47 +02:00
Tobias Stoeckmann 4e65ac7c4e Merge pull request #3052 from stoeckmann/tar_wempty
tar: Fix OOB with empty wide character directory names
(cherry picked from commit 51e9cd6dc7)
2026-06-23 10:30:43 +02:00
Tobias Stoeckmann d01e6841b9 Merge pull request #3035 from stoeckmann/acl_string
acl: Simplify string creation
(cherry picked from commit 97595197b2)
2026-06-23 10:30:38 +02:00
Tobias Stoeckmann 357584ab84 Merge pull request #3041 from stoeckmann/xar_fflags
xar: Fix writer OOB accesses with fflags
(cherry picked from commit e681e45b31)
2026-06-23 10:30:33 +02:00
Dustin L. Howett c02b920204 Merge pull request #3060 from stoeckmann/xar_free
xar: fix fflags_text leak in file_free
(cherry picked from commit 6f95523f45)
2026-06-23 10:30:28 +02:00
Tim Kientzle cf940136f4 Merge pull request #3056 from markjdb/master
libarchive: Force GNU iconv compatibility on FreeBSD
(cherry picked from commit c97baadd86)
2026-06-23 10:30:20 +02:00
Tim Kientzle 5fa09a3d75 Merge pull request #3054 from i1011/add-filter-mismatch-fix
filter: Fix mismatched filter function dispatch table entry in archive_write_add_filter.c
(cherry picked from commit 2e183f664c)
2026-06-23 10:30:15 +02:00
Tobias Stoeckmann 4ba63aef60 Merge pull request #3027 from stoeckmann/xar_debug
xar: Do not modify variables in DEBUG block
(cherry picked from commit fd182c5ba5)
2026-06-23 10:30:04 +02:00
Tobias Stoeckmann df4e4dd186 Merge pull request #3033 from stoeckmann/filter_strcpy
filter: Remove unneeded strcpy calls
(cherry picked from commit 0637bc4221)
2026-06-23 10:30:00 +02:00
Tobias Stoeckmann 2f159f7aa0 Merge pull request #3036 from stoeckmann/cmdline_strdup
cmdline: Use free+strdup instead of realloc+strcpy
(cherry picked from commit 14c07f64ae)
2026-06-23 10:29:45 +02:00
Tobias Stoeckmann 5e7df90b13 Merge pull request #3037 from stoeckmann/strmode_strcpy
strmode: Remove strcpy usage
(cherry picked from commit ccd2dfbdb2)
2026-06-23 10:29:40 +02:00
Tobias Stoeckmann 2dbbe14922 Merge pull request #3044 from stoeckmann/util_windows_toctou
util: Fix GetTempPathW TOCTOU race condition
(cherry picked from commit b9eea3e51a)
2026-06-23 10:29:33 +02:00
Dustin L. Howett dff55d6599 Merge pull request #3043 from datauwu/cpio-patch
(cherry picked from commit a651b4fcd8)
2026-06-23 10:29:25 +02:00
Tim Kientzle cd111c221f Merge pull request #3040 from kientzle/fix/unchecked-alloc
Fix a number of unchecked memory allocations

(cherry picked from commit c18a5c7e5f)
2026-06-23 10:29:16 +02:00
Tobias Stoeckmann 9ac3536e31 Merge pull request #3038 from stoeckmann/tar_util_string
tar: Improve string safety in list_item_verbose
(cherry picked from commit 7eeaced525)
2026-06-23 10:29:10 +02:00
Tim Kientzle bd5fcd8bc8 Merge pull request #3032 from stoeckmann/dotdot
Port iso9660 fix for `..` (dot dot) path normalization to mtree and xar

(cherry picked from commit 89a6d760c1)
2026-06-23 10:28:50 +02:00
Tim Kientzle ea38c9f442 Merge pull request #3028 from br0nzu/xar-fstype-cleanup
Free XAR xattr fstype metadata during cleanup

(cherry picked from commit 27b08f61da)
2026-06-23 10:28:31 +02:00
Tim Kientzle 66ac5d3ce8 Merge pull request #3030 from stoeckmann/xar_atol
xar: Avoid integer overflows in number parsers
(cherry picked from commit 6d15675331)
2026-06-23 10:28:26 +02:00
Tim Kientzle 38b2346e91 Merge pull request #3029 from stoeckmann/iso_memleak
iso9660: Fix memory leaks on error paths
(cherry picked from commit d0ee2d32ef)
2026-06-23 10:28:22 +02:00
Tim Kientzle b126a0d2a6 Merge pull request #3020 from stoeckmann/sparse_uaf_test
sparse: Add archive_entry_sparse_reset test
(cherry picked from commit 1546fbffe8)
2026-06-23 10:28:09 +02:00
Tim Kientzle 13128342f2 Merge pull request #3016 from ZX41R/oss-fuzz-write-disk-secure-coverage
Improve write-disk fuzzer coverage

(cherry picked from commit dca1bcd27d)
2026-06-23 10:27:59 +02:00
Tim Kientzle 833f14d563 Merge pull request #3015 from datauwu/master
rar: avoid reading NEWSUB extended data during header parsing
(cherry picked from commit 6246a35326)
2026-06-23 10:27:52 +02:00
Tim Kientzle 2c40fc5563 Merge pull request #2978 from stoeckmann/joliet_id_loop
iso9660: Fix infinite loop in Joliet ID generation
(cherry picked from commit 0ec85e45e4)
2026-06-23 10:27:45 +02:00
Tim Kientzle cfbbd2bf44 Merge pull request #2928 from stoeckmann/anchor_no_flags
pathmatch: Treat anchors not special without flags
(cherry picked from commit 5ed0b5ea88)
2026-06-23 10:27:41 +02:00
Tim Kientzle 68868d1602 Merge pull request #2927 from stoeckmann/pathmatch_recursion
archive_match: Prevent call stack overflow

(cherry picked from commit 5aa477220e)
2026-06-23 10:27:36 +02:00
Tim Kientzle 300fb6d21a Merge pull request #2930 from stoeckmann/mtree_option
mtree: Fix time value parser truncation
(cherry picked from commit dda246a62e)
2026-06-23 10:27:29 +02:00
Tim Kientzle c4e0e732bd Merge pull request #2929 from stoeckmann/7zip_codec_id
7zip: Verify that Codec ID fits into 63 bit
(cherry picked from commit abed05f954)
2026-06-23 10:27:25 +02:00
Tim Kientzle f8efc263db Merge pull request #2982 from stoeckmann/mtree_hex
mtree: Fix hex parser
(cherry picked from commit c25415ade4)
2026-06-23 10:27:20 +02:00
Tim Kientzle df9fb12ae4 Merge pull request #2974 from stoeckmann/joliet_id
iso9660: Fix OOB during Joliet ID generation
(cherry picked from commit a330921e49)
2026-06-23 10:27:16 +02:00
Tim Kientzle fdec7dd378 Merge pull request #2969 from stoeckmann/glibc234
Fix build with glibc 2.43

(cherry picked from commit 3f7a004055)
2026-06-23 10:27:12 +02:00
Tim Kientzle 63dbb41933 Merge pull request #3019 from kientzle/kientzle-sparse-uaf-012
[sparse] UAF in sparse_reset

(cherry picked from commit f5166ca923)
2026-06-23 10:26:56 +02:00
Tim Kientzle d8c51eadaa Merge pull request #3018 from tbkka/tbkka-mtree-null-deref-014
[MTREE] NULL pointer deref during archive close

(cherry picked from commit bcb158d409)
2026-06-23 10:26:53 +02:00
Tim Kientzle e85c311c90 Merge pull request #3017 from tbkka/tbkka-iso9660-015-019
[ISO9660] Fix NULL deref and Joliet ID overflow

(cherry picked from commit 98f3579020)
2026-06-23 10:26:45 +02:00
Tim Kientzle 85c41465ab Merge pull request #3013 from tbkka/tbkka-xar-undefined-011-018
[XAR] Fix two UB

(cherry picked from commit cb9f77e6e5)
2026-06-23 10:26:40 +02:00
Tim Kientzle 0a011dc95e Merge pull request #2984 from tyler-yankee/cpio-hardlink-pathname-null
cpio reader: Validate pathname in record_hardlink

(cherry picked from commit 411a4479b9)
2026-06-23 10:26:35 +02:00
Tim Kientzle cfb951b737 Merge pull request #3014 from kientzle/kientzle-test_utils-ub
[test_utils] Fix a minor UB

(cherry picked from commit 1fcae10bf7)
2026-06-23 10:26:24 +02:00
Tim Kientzle 63ea3ef99e Merge pull request #3012 from tbkka/tbkka-pathmatch-buffer-overread-003
[pathmatch] Heap buffer over-read

(cherry picked from commit b3b546d008)
2026-06-23 10:26:18 +02:00
Tim Kientzle 5ad5783920 Merge pull request #3011 from tbkka/tbkka-tar-acl-oob-002
[ACL] Parser out-of-bounds read

(cherry picked from commit 58810c2fae)
2026-06-23 10:26:12 +02:00
Tim Kientzle 8cf7393f98 Merge pull request #3010 from kientzle/kientzle-overlarge-dates
Date parsing: reject dates with numbers of more than 4 digits

(cherry picked from commit c6322495f1)
2026-06-23 10:25:52 +02:00
Jose Luis Duran 2766b9b1eb mtree: Do not append '/' when basename is '.'
If the basename is '.', it means it is the root directory ('/').  Do not
append '/' to '.', as this will produce a path '/.', resulting in an
invalid mtree entry.

For example, using base.txz from FreeBSD:

    tar -c -f - --format=mtree @base.txz | mtree -C

(cherry picked from commit dc88807502)
2026-06-23 10:25:45 +02:00
Tim Kientzle 5d92b0c38b Merge pull request #3009 from kientzle/archive-read-sticky-fatal
Minor cleanups from #2298

(cherry picked from commit 73c4f1c03f)
2026-06-23 10:25:38 +02:00
Tim Kientzle c2edc8d181 Merge pull request #2998 from kientzle/archive-read-sticky-fatal
archive_read: FATAL should be sticky for all API calls

(cherry picked from commit e01eeb274d)
2026-06-23 10:25:31 +02:00
Tim Kientzle 2df65d402d Merge pull request #3007 from jlduran/escape-vis-glob-chars
mtree: Escape standard pathname matching characters
(cherry picked from commit 4b65c3866b)
2026-06-23 10:25:26 +02:00
Tim Kientzle d424fecfbc Merge pull request #3006 from stoeckmann/7zip_32
7zip: Fix 32 bit heap overflow
(cherry picked from commit 4fde023514)
2026-06-23 10:25:06 +02:00
Tim Kientzle 9ab6ce043a Merge pull request #3005 from kientzle/kientzle-automatic-test-discovery
[CMake] Automatically update `list.h`

(cherry picked from commit 398b7b6f73)
2026-06-23 10:24:58 +02:00
Tim Kientzle ebc236309a Merge pull request #3000 from kientzle/kientzle-cab-hardening
[CAB] Harden the handling of invalid headers

(cherry picked from commit c8afaafb5c)
2026-06-23 10:24:49 +02:00
Tim Kientzle 9011226ba9 Merge pull request #3004 from kientzle/kientzle-rar5-bad-tables
[RAR5] FAIL if the decode table is > 2^16

(cherry picked from commit 60edb22a0b)
2026-06-23 10:24:44 +02:00
Tim Kientzle e1c2388cda Merge pull request #3002 from kientzle/7zip-setup-decode-folder-state-order
[7zip] Clean up the failure path in `setup_decode_folder`

(cherry picked from commit 3526803cb4)
2026-06-23 10:24:39 +02:00
Tim Kientzle 64f84f735b Merge pull request #3003 from kientzle/kientzle-test-runner-name-args
Clarify the test harness usage

(cherry picked from commit aa43119e35)
2026-06-23 10:24:35 +02:00
Tim Kientzle 2727f09c47 Merge pull request #3001 from kientzle/kientzle-7zip-test-more-tolerant
Suppress spurious failures from old liblzma

(cherry picked from commit e9d68b030d)
2026-06-23 10:24:20 +02:00
Tim Kientzle 3741a47683 Merge pull request #2992 from kientzle/kientzle-acl-isint-overflow
Expand ACL testing

(cherry picked from commit b18956ea60)
2026-06-23 10:24:14 +02:00
Tim Kientzle d6e8e98886 Merge pull request #2991 from kientzle/kientzle-tar-timestamp-hardening
[tar] Harden timestamp parsing

(cherry picked from commit ca7f0bfa93)
2026-06-23 10:24:10 +02:00
Tim Kientzle fa35c91f89 Merge pull request #2996 from kientzle/kientzle-zip-empty-pathname
[Zip] Reject empty pathnames in ZIP writer

(cherry picked from commit 4c19c1ed14)
2026-06-23 10:23:56 +02:00
Tim Kientzle eb482315a0 Merge pull request #2993 from kientzle/kientzle-zip-long-pathnames
[Zip] Don't try to write overlong pathnames

(cherry picked from commit 6fcf9b4589)
2026-06-23 10:22:55 +02:00
Tim Kientzle e96c2ecc8c Merge pull request #2990 from kientzle/kientzle-gitignore-AI-files
Ignore local CLAUDE/GEMINI files

(cherry picked from commit 1cc5c21be2)
2026-06-23 10:17:20 +02:00
Tim Kientzle 2999b38d53 Merge pull request #2989 from kientzle/kientzle-test-documentation
Minor clarification on test discovery

(cherry picked from commit 4b66fc68e4)
2026-06-23 10:17:16 +02:00
Martin Matuška 5658b6bba9 Merge pull request #2985 from stoeckmann/7zip_sfx
7zip: Harden SFX parser
(cherry picked from commit 740be68fc0)
2026-06-23 10:17:08 +02:00
Martin Matuška f1632df055 Merge pull request #2988 from kientzle/kientzle-acl-to-text
[archive_acl] Fix buffer overrun and wrong output for NULL-name ACL entries

(cherry picked from commit cf9bc89194)
2026-06-23 10:16:43 +02:00
Tim Kientzle 0635a02739 Merge pull request #2983 from kientzle/kientzle-iso9660-joliet-pathname
[iso9660] Fix joliet pathname overflow

(cherry picked from commit 0755b9eba0)
2026-06-23 10:16:37 +02:00
Tim Kientzle a26435302e Merge pull request #2973 from dag-erling/des/darwin-crypto
On Darwin, get digests from libsystem

(cherry picked from commit f33f07442a)
2026-06-23 10:16:33 +02:00
Tim Kientzle ba5d675183 Merge pull request #2526 from fdegros/compress_support
Fix SIGSEGV in compress filter when appended before open

(cherry picked from commit 4f3cf235e3)
2026-06-23 10:16:15 +02:00
Tim Kientzle 0f9f5c8871 Merge pull request #2980 from kientzle/kientzle-7zip-numfiles
[7zip] Sanity-check the number of files

(cherry picked from commit f18c7cb45c)
2026-06-23 10:16:10 +02:00
Tim Kientzle fc095ba87d Merge pull request #2981 from kientzle/kientzle-zip-lzma-memory
[Zip] Limit the LZMA initialization to 64MiB memory

(cherry picked from commit a2de48dd0f)
2026-06-23 10:15:59 +02:00
Tim Kientzle eb1b2be496 Merge pull request #2964 from kientzle/kientzle-test-documentation
Document how to write new tests and how to build and run test suites

(cherry picked from commit df55563f0e)
2026-06-23 10:15:55 +02:00
Tim Kientzle c2b9f38189 Merge pull request #2979 from tyler-yankee/cab-huffman-memcheck
cab reader: Fix use of uninitialized values from Huffman table

(cherry picked from commit 7439210634)
2026-06-23 10:15:44 +02:00
Tim Kientzle 3513a93276 Merge pull request #2966 from solbjorn/win-crypt-unforce
libarchive: fix Windows compilation with `ENABLE_CNG=OFF`
(cherry picked from commit d8ca779e4d)
2026-06-23 10:07:36 +02:00
Tim Kientzle e1848bcb3d Merge pull request #2971 from stoeckmann/asan_memleak
Fix mem leaks found with ASAN-enabled test suites

(cherry picked from commit cb779c5d26)
2026-06-23 10:07:20 +02:00
Tim Kientzle a88ed58534 Merge pull request #2739 from DHowett/remove-wincrypt
windows: remove support for WinCrypt
(cherry picked from commit be31ad37f3)
2026-06-23 10:03:44 +02:00
Tim Kientzle b140962af6 Merge pull request #2970 from stoeckmann/gitignore
build: Add more entries to .gitignore
(cherry picked from commit 92c430d484)
2026-06-23 10:01:29 +02:00
Tim Kientzle 6e6865af32 Merge pull request #2968 from stoeckmann/isofile_gen_utility_names_dotdot
iso9660: Fix `..` (dot dot) path normalization
(cherry picked from commit 45d9c12632)
2026-06-23 10:01:21 +02:00
Tim Kientzle 7242dfa1d8 Merge pull request #2965 from bgilbert/distcheck
Have `make distcheck` verify CMake build succeeds

(cherry picked from commit 6411fc8500)
2026-06-23 10:01:07 +02:00
Tim Kientzle 5f70255432 Merge pull request #2905 from Patsakas/Patsakas-fix-acl-bug
Fix NULL pointer increment in archive_acl_from_text_nl

(Not a security issue, and arguably not really even a bug, but easy to fix regardless.)

(cherry picked from commit 0b0b888f86)
2026-06-23 10:01:00 +02:00
Martin Matuška c883e895ba Merge pull request #2961 from bgilbert/malformed
Add malformed CAB test to Autotools

(cherry picked from commit 2860b2a792)
2026-06-23 10:00:56 +02:00
Martin Matuška 1c85a09812 Merge pull request #2962 from dag-erling/des/optreset
unzip: Remove dead code
test_main: Staticize some variables

(cherry picked from commit fc76727081)
2026-06-23 10:00:52 +02:00
Tim Kientzle 6aab168c09 Merge pull request #2942 from benoit-pierre/pr/fix___LA_MODE_T_handling
fix `archive_entry_set_mode` & `archive_entry_set_perm`

(cherry picked from commit aca8b0d3d2)
2026-06-23 10:00:43 +02:00
Tim Kientzle ceab9ccba1 Merge pull request #2957 from kientzle/kientzle-linkresolver
Fix a double-free in the link resolver

(cherry picked from commit 6d9dddbab1)
2026-06-23 10:00:14 +02:00
Martin Matuska ded82291ab Release 3.8.7 2026-04-13 11:00:33 +02:00
Tim Kientzle 924b53d6a1 Merge pull request #2952 from solbjorn/ppmd-symbols
libarchive/ppmd8: mark the remaining functions static

(cherry picked from commit f78019b41c)
2026-04-13 08:43:05 +02:00
Tim Kientzle 1fdfac61bd Merge pull request #2898 from ElhananHaenel/fix/rar3-lzss-window-realloc
rar: fix LZSS window size mismatch after PPMd block
(cherry picked from commit 762b30011a)
2026-04-13 08:43:01 +02:00
Tim Kientzle 420a7d60fb Merge pull request #2934 from ElhananHaenel/fix/zisofs-validate-log2bs
FIX - iso9660: validate pz_log2_bs, add test for 32-bit heap overflow

(cherry picked from commit f76218f309)
2026-04-13 08:42:55 +02:00
Tim Kientzle 58a4f7c43b Merge pull request #2924 from stoeckmann/pathmatch_pm
pathmatch: Anchors within pattern not special
(cherry picked from commit 34f7d8c73e)
2026-04-13 08:42:52 +02:00
Tim Kientzle bea79d8f82 Merge pull request #2922 from stoeckmann/err_style_followup
Improve style of more error messages

(cherry picked from commit aaf154f627)
2026-04-13 08:42:29 +02:00
Tim Kientzle ec1bc43156 Merge pull request #2897 from ElhananHaenel/fix/iso_zisofs_undefined_behavior
iso9660: validate pz_log2_bs in parse_rockridge_ZF1()
(cherry picked from commit 071e2e1c59)
2026-04-13 08:41:32 +02:00
Tim Kientzle 3b9fc9e811 Merge pull request #2947 from fdegros/lzop_support
LZOP and GRZIP support

(cherry picked from commit 2bb6f3461c)
2026-04-13 08:40:32 +02:00
Tim Kientzle 1c0fbf3382 Merge pull request #2943 from bgilbert/test
Add v7 tar filename encoding test to Autotools

(cherry picked from commit 30335f92d9)
2026-04-13 08:40:20 +02:00
Tim Kientzle f2b3c5fc92 Merge pull request #2919 from LoboQ1ng/fix-cab-lzx-oob
Fix Heap OOB Write in CAB LZX decoder

(cherry picked from commit 8f6614c378)
2026-04-13 08:40:10 +02:00
Tim Kientzle d4896fadce Merge pull request #2939 from stoeckmann/cpio_mem_leak
cpio: Fix `-R` memory leak
(cherry picked from commit 24f4626777)
2026-04-13 08:39:58 +02:00
Tim Kientzle 810d24fc34 Merge pull request #2940 from wrp/wrp/doc
Provide more details on autotool meta-files

(cherry picked from commit 7229570c84)
2026-04-13 08:39:18 +02:00
Tim Kientzle ec19cb8097 Merge pull request #2921 from stoeckmann/err_style_regression
Fix Windows test regression

(cherry picked from commit 4613cc9d79)
2026-04-13 08:39:04 +02:00
Tim Kientzle 8aa7df51cc Merge pull request #2912 from stoeckmann/pax_ugid
pax: Remove uid/gid cast in value range check
(cherry picked from commit 54436854a4)
2026-04-13 08:38:55 +02:00
Tim Kientzle 441f245951 Merge pull request #2913 from stoeckmann/cpio_buff
cpio: Reduce visibility of variable buff
(cherry picked from commit 7a5ec15781)
2026-04-13 08:38:51 +02:00
Tim Kientzle 38e0db1561 Merge pull request #2915 from stoeckmann/err_style
libarchive: Improve error message style
(cherry picked from commit be30e16fea)
2026-04-13 08:38:47 +02:00
Tim Kientzle 34b19b772b Merge pull request #2911 from stoeckmann/libarchive_opt_vals
libarchive: Check number ranges of supplied option values
(cherry picked from commit f084dfae97)
2026-04-13 08:38:30 +02:00
Tim Kientzle ab95301c36 Merge pull request #2910 from stoeckmann/cpio_num
cpio: Check number arguments before casts
(cherry picked from commit 284a0a103f)
2026-04-13 08:38:21 +02:00
Tim Kientzle 7c58744a67 Merge pull request #2909 from stoeckmann/lafe_error
tools: Remove `Error : ` prefix in lafe_errc calls
(cherry picked from commit 9d1631752b)
2026-04-13 08:38:17 +02:00
Tim Kientzle 5e7ca4014f Merge pull request #2908 from stoeckmann/cpio_mode
cpio: Improve mode option handling
(cherry picked from commit 339b0e7003)
2026-04-13 08:38:11 +02:00
Tim Kientzle aa6f031df4 Merge pull request #2872 from stoeckmann/filter_options_failed
filter options: Use ARCHIVE_FAILED on errors

(cherry picked from commit 568bfc7c50)
2026-04-13 08:38:04 +02:00
Tim Kientzle f0a821c493 Merge pull request #2899 from stoeckmann/cpio_rename
cpio: Allow long paths with -r option
(cherry picked from commit 9cfee00d70)
2026-04-13 08:37:44 +02:00
Tim Kientzle 62ad1ee508 Merge pull request #2871 from stoeckmann/archive_options_either
libarchive: Correctly handle option failures
(cherry picked from commit f59ed04545)
2026-04-13 08:37:27 +02:00
Tim Kientzle 5887052909 Merge pull request #2900 from LoboQ1ng/fix-cab-null-deref
Fix NULL pointer dereference in CAB parser during skip

(cherry picked from commit aab503881d)
2026-04-13 08:37:19 +02:00
Tim Kientzle dbe33d32aa Merge pull request #2903 from ZUENS2020/codex/fix-untar-parseoct-bounds-check
Fix OOB read in contrib/untar.c parseoct()

(cherry picked from commit 33dab8959d)
2026-04-13 08:37:14 +02:00
Tim Kientzle ae03a76592 Merge pull request #2901 from stoeckmann/cpio_llp64
tools: Cast int64_t to long long in printf
(cherry picked from commit b5f1272333)
2026-04-13 08:36:50 +02:00
Martin Matuska 3a9249b4ee Release 3.8.6 2026-03-10 09:37:45 +01:00
Tim Kientzle ec19fcbd20 Merge pull request #2877 from kientzle/kientzle-rar5-loop-bug
Infinite loop in Rar5 decompression

(cherry picked from commit 78b632c336)
2026-03-10 09:32:23 +01:00
Tim Kientzle 228c054dc6 Merge pull request #2896 from kientzle/kientzle-fix-omitted-uu
Add UU file from #2864 to Makefile.am

(cherry picked from commit e480b80eb4)
2026-03-10 09:32:07 +01:00
Tim Kientzle c21758bf11 Merge pull request #2889 from OwenSanzas/fix/linkify-fuzzer-double-free
Fix double-free in libarchive_linkify_fuzzer

(cherry picked from commit a549c5eb8b)
2026-03-10 09:31:55 +01:00
Tim Kientzle f43998958b Merge pull request #2864 from vdsilva/patch
7zip: Fix SEGV in check_7zip_header_in_sfx via ELF offset validation
(cherry picked from commit 219639c764)
2026-03-10 09:31:48 +01:00
Tim Kientzle db3fc0e96a Merge pull request #2892 from antekone/feature/8192-filters-memleak/1
RAR5 reader: fix potential memory leak

(cherry picked from commit 6fa79fb56e)
2026-03-10 09:31:23 +01:00
Tim Kientzle 939bbe39c0 Merge pull request #2893 from antekone/feature/github/1963/init-twice/1
RAR5 reader: fix SIGSEGV when archive_read_support_format_rar5 is called twice

(cherry picked from commit 5a1f39d8f3)
2026-03-10 09:31:13 +01:00
Tim Kientzle 5bb5988601 Merge pull request #2895 from antekone/feature/github-1980/memleak-in-cab/1
CAB reader: fix memory leak on repeated calls to archive_read_support_format_cab

(cherry picked from commit 639412f636)
2026-03-10 09:31:08 +01:00
Tim Kientzle d345984235 Merge pull request #2888 from seb128/archive-read-valgrind
archive_read: optimize string copy, avoid redundant strlen

(cherry picked from commit ebf23148a8)
2026-03-10 09:30:55 +01:00
Tim Kientzle 0340130c5a Merge pull request #2885 from kpatsakis/signature-malloc-null-check
Unchecked malloc result in archive_read_support_filter_program_signature()

(cherry picked from commit 7f34e20817)
2026-03-10 09:29:58 +01:00
Tim Kientzle 8aaeec9c61 Merge pull request #2855 from dag-erling/des/mkdir-errno
archive_write_disk_posix: Report correct error

(cherry picked from commit 0a35627ec8)
2026-03-10 09:29:43 +01:00
Tim Kientzle ec5fb491a4 Merge pull request #2856 from bradking/pathname-encoding
archive_write: Fix crash on failure to convert WCS/UTF-8 pathname to MBS

(cherry picked from commit 180d602353)
2026-03-10 09:29:38 +01:00
Tim Kientzle 2a6e65e2fd Merge pull request #2880 from kientzle/kientzle-lha-oversize-header
Reject LHA archives with ridiculously large headers

(cherry picked from commit d31126d0bc)
2026-03-10 09:29:26 +01:00
Tim Kientzle bcf2d9e0ee Merge pull request #2878 from LoboQ1ng/fix-mtree-fd-leak
Fix file descriptor leak in mtree parser cleanup (CWE-775)

(cherry picked from commit d7598c04d3)
2026-03-10 09:29:15 +01:00
Tim Kientzle bfc638ce65 Merge pull request #2879 from kientzle/kientzle-prune-freebsd-ci
Prune FreeBSD CI from 10 variations down to 3

(cherry picked from commit 21d60cb6af)
2026-03-10 09:29:08 +01:00
Tim Kientzle 444c520e31 Merge pull request #2875 from bradking/7z-elf64
7zip: Fix out-of-bounds access on ELF 64-bit header
(cherry picked from commit 67830f7b9c)
2026-03-10 09:28:48 +01:00
Tim Kientzle 9821e87349 Merge pull request #2858 from FooIbar/nettle-4.x
Fix incompatibility with Nettle 4.x

(cherry picked from commit a255a84250)
2026-03-10 09:28:17 +01:00
Tim Kientzle f9d9adbe17 Merge pull request #2860 from xTibor/fix-iso-year
bsdunzip: Fix ISO week year and Gregorian year confusion
(cherry picked from commit f75b6b6e2c)
2026-03-10 09:28:12 +01:00
Tim Kientzle 8c04ac3c91 Merge pull request #2859 from zhangjy1014/fix-issue-2744
Fix NULL pointer dereference in archive_acl_from_text_w()

(cherry picked from commit a4d325b2ef)
2026-03-10 09:27:54 +01:00
Martin Matuska dd897a78c6 Release 3.8.5 2026-01-05 10:49:24 +01:00
Martin Matuška 1835ca5f03 Merge pull request #2781 from AZero13/ints
Remove unneeded int cast

(cherry picked from commit 3cd503b75a)
2026-01-05 10:44:15 +01:00
Martin Matuška 1decf414b0 Merge pull request #2836 from ngie-eign/add-freebsd-15-cirrus-ci
Expand the test matrix to include 15.x images/ZFS

(cherry picked from commit 02eba33825)
2026-01-05 10:43:57 +01:00
Tim Kientzle 4ee2199ea9 Merge pull request #2835 from jmcarp/build-illumos
Skip unsupported linker options on illumos.

(cherry picked from commit e663efb430)
2026-01-05 10:43:47 +01:00
Tim Kientzle 5d015feb39 Merge pull request #2825 from AZero13/patch-2
Error check ret before calling copy_seek_stat

(cherry picked from commit e91171c9a0)
2025-12-28 13:13:33 +01:00
Tim Kientzle 0793148e77 Merge pull request #2824 from AZero13/qosflags
Remove bitmask typo in dwSecurityQosFlags

(cherry picked from commit 7f27446a51)
2025-12-28 13:13:28 +01:00
Tim Kientzle 8d70f77268 Merge pull request #2827 from AZero13/free
Simplify file free

(cherry picked from commit 090fbc3655)
2025-12-28 13:13:24 +01:00
Tim Kientzle 6f9adc5d5c Merge pull request #2829 from AZero13/leak-shar
archive_write_shar_header: free shar->last_dir before replacement

(cherry picked from commit 8c2241a7e4)
2025-12-28 13:13:20 +01:00
Tim Kientzle bf7ce66466 Merge pull request #2830 from AZero13/return
return early if archive_write_set_format_shar fails

(cherry picked from commit d54b2241b9)
2025-12-28 13:13:16 +01:00
Tim Kientzle 7289ed5437 Merge pull request #2831 from AZero13/check-copy-length
Use copy_length as upper-bound, not strlen(p)

(cherry picked from commit 782cdd88b6)
2025-12-28 13:13:13 +01:00
Tim Kientzle 56d9da48a9 Merge pull request #2834 from AZero13/patch-5
Use #warning, not #warn

(cherry picked from commit d1b87af584)
2025-12-28 13:13:08 +01:00
Martin Matuška c8ea1e5da2 Merge pull request #2813 from AZero13/memcpy
We copy from p, not p + module_len

(cherry picked from commit b2d68e2f1a)
2025-12-26 10:23:58 +01:00
Martin Matuška 2805282a16 Merge pull request #2796 from vcoxvco/fix_unninit
libarchive/archive_util.c: Uninitialized variable

(cherry picked from commit 1cd0b9179c)
2025-12-25 10:21:28 +01:00
Martin Matuška bec0337316 Merge pull request #2816 from AZero13/strdup
Error check strdup for path name

(cherry picked from commit 095609e89b)
2025-12-25 10:21:22 +01:00
Martin Matuška 2d0d2311d3 Merge pull request #2814 from AZero13/gname
uname_override checks gname_override when it should check uname_override

(cherry picked from commit 5c84afd664)
2025-12-25 10:21:17 +01:00
Martin Matuška 8216512c8e Merge pull request #2789 from libarchive/dependabot/github_actions/all-actions-50b857948b
CI: Bump the all-actions group across 1 directory with 3 updates
(cherry picked from commit f366e98107)
2025-12-25 10:21:12 +01:00
Martin Matuška 8eda7c5277 Merge pull request #2815 from AZero13/=
Use >=, not =>

(cherry picked from commit c4597a73f3)
2025-12-25 10:21:06 +01:00
Martin Matuška 2b8c75323d Merge pull request #2819 from GabrielBarrantes/work/typos
Improve wording

(cherry picked from commit 8042630d4f)
2025-12-25 09:59:46 +01:00
Martin Matuška ab14459373 Merge pull request #2820 from skypher/oss-fuzz-expansion
Expand OSS-Fuzz integration: 1 → 25 fuzz targets

(cherry picked from commit 214ee3edc7)
2025-12-25 09:59:41 +01:00
Tim Kientzle f32ff85bc3 Merge pull request #2812 from AZero13/w
Fix p == null copy paste error

(cherry picked from commit 6e77f521fa)
2025-12-25 09:59:31 +01:00
Tim Kientzle b86d49bcf4 Merge pull request #2807 from KlaraSystems/des/list-tests
Add option to list tests

(cherry picked from commit b51e59bcfb)
2025-12-25 09:59:24 +01:00
Martin Matuška e108f0dfab Merge pull request #2809 from mmatuska/fix/2787
tar: fix off-bounds read resulting from #2787 (3150539ed)
(cherry picked from commit a7f3b56af6)
2025-12-25 09:59:10 +01:00
Tim Kientzle a84ebc59c1 Merge pull request #2805 from fredldotme/android-recovery
libarchive & contrib: Build as static binary for the Android recovery

(cherry picked from commit 8c86c46d1b)
2025-12-25 09:57:01 +01:00
Martin Matuska d114ceee6d Release 3.8.4 2025-12-01 13:39:19 +01:00
Martin Matuška 7d94cdaf66 Merge pull request #2800 from mmatuska/fix/freebsdci
CI: use gmake in Cirrus FreeBSD build
(cherry picked from commit 728b43c0c1)
2025-12-01 13:32:53 +01:00
Martin Matuška 2ded466c2a Merge pull request #2797 from mmatuska/fix/treefuncs
Partially revert "Merge pull request #2679 from AZero13/error"

(cherry picked from commit a819cc2829)
2025-11-28 11:47:47 +01:00
Tim Kientzle e00289a268 Merge pull request #2799 from AZero13/idk
Prevent unneeded truncation

(cherry picked from commit 1b9b42720f)
2025-11-28 11:47:40 +01:00
Tim Kientzle 08cb8d2121 Merge pull request #2791 from KlaraSystems/des/383-fixes
Fix issues encountered while importing 3.8.3 downstream

(cherry picked from commit 8ef2084104)
2025-11-28 11:47:33 +01:00
Tim Kientzle e65d075083 Merge pull request #2792 from KlaraSystems/des/generate-list
Generate test lists reliably and deterministically

(cherry picked from commit e17f169356)
2025-11-28 11:47:27 +01:00
Tim Kientzle 8d6b2335df Merge pull request #2793 from bgilbert/rar
Add missing rar5 test case to dist

(cherry picked from commit 47809f10bf)
2025-11-28 11:47:21 +01:00
Tim Kientzle df9967323e Merge pull request #2787 from ljdarj/aar
Fix bsdtar zero-length pattern issue.

(cherry picked from commit 81bc00a549)
2025-11-28 11:47:09 +01:00
Martin Matuska 1368b08875 Release 3.8.3 2025-11-17 20:39:55 +01:00
Martin Matuška 476369f600 Merge pull request #2771 from mostynb/lz4_with_leading_skippable_frames
Support both lz4 and zstd data with leading skippable frames

(cherry picked from commit ce7b3f1c15)
2025-11-17 20:34:26 +01:00
Martin Matuška d59cf5aa65 Merge pull request #2751 from KlaraSystems/des/zip_magic_numbers
Avoid magic numbers in zip support code

(cherry picked from commit dbacda991c)
2025-11-17 20:34:22 +01:00
Martin Matuška ec3bcb46e0 Merge pull request #2752 from KlaraSystems/des/safe-writes-umask
Set umask before testing safe writes

(cherry picked from commit 2caee6a37e)
2025-11-17 20:34:17 +01:00
Martin Matuška f1ad45f513 Merge pull request #2755 from mmatuska/fix/cirrusci
CI: update FreeBSD 14 build environment
(cherry picked from commit d5bd2dfafe)
2025-11-17 20:34:00 +01:00
Tim Kientzle de18ca9888 Merge pull request #2783 from YoshiRulz/docs-fix-typo
Fix typo in archive_entry_stat(3) man page

(cherry picked from commit e1c3061b12)
2025-11-17 20:21:26 +01:00
Tim Kientzle 17526e5c52 Merge pull request #2738 from cmcgee1024/add_clang_module_map
Add a clang module map for libarchive

(cherry picked from commit c2333a511d)
2025-11-17 20:21:15 +01:00
Tim Kientzle 0da204ab11 Merge pull request #2778 from AZero13/result-0
Set *result to 0 when the tar flush fails.

(cherry picked from commit c5cc510145)
2025-11-17 20:20:46 +01:00
Tim Kientzle c9b5cf5910 Merge pull request #2654 from AZero13/swapping-2
s is a signed int, so make it signed int

(cherry picked from commit ab09af7304)
2025-11-17 20:20:40 +01:00
Tim Kientzle 50716e1959 Merge pull request #2779 from AZero13/descriptor
file_open should close if fstat fails

(cherry picked from commit e929454ec8)
2025-11-17 20:20:34 +01:00
Tim Kientzle 30ca142b35 Merge pull request #2775 from AZero13/off-by-one
[tar] Bounds check newdir_len

(cherry picked from commit 26c769ecdc)
2025-11-17 20:20:20 +01:00
Tim Kientzle 7f4314ca47 Merge pull request #2769 from kientzle/kientzle-issue2765
Fix a buffer overrun when reading truncated 7zip headers

(cherry picked from commit fa5f70627c)
2025-11-17 20:20:05 +01:00
Tim Kientzle 88ca4fcf98 Merge pull request #2772 from moubctez/forget_name_max
Remove name_max leftover

(cherry picked from commit c45a07854d)
2025-11-17 20:19:57 +01:00
Tim Kientzle 82b57a9740 Merge pull request #2768 from Commandoss/master
Fix for an out-of-bounds buffer overrun when using p[H_LEVEL_OFFSET]

(cherry picked from commit ce614c6524)
2025-11-17 20:19:34 +01:00
Tim Kientzle 0646e21c6f Merge pull request #2767 from KlaraSystems/des/posix_spawn
Replace system() with posix_spawn() if available

(cherry picked from commit 8855146220)
2025-11-17 20:19:24 +01:00
Tim Kientzle 076a050bbf Merge pull request #2766 from mostynb/fix_mac_signed_unsigned_comparison
Fix signed-unsigned comparison in add_trivial_nfs4_acl

(cherry picked from commit edbada88c0)
2025-11-17 20:19:17 +01:00
Tim Kientzle c359384806 Merge pull request #2753 from KlaraSystems/des/temp-files
Create temporary files in the target directory

(cherry picked from commit d2e861769c)
2025-11-17 20:18:44 +01:00
Martin Matuska 7f53fce04e Release 3.8.2 2025-10-15 23:36:59 +02:00
Tim Kientzle ed84daf889 Merge pull request #2737 from kientzle/kientzle-volume-header-overflow
Fix an infinite loop when parsing `V` headers

(cherry picked from commit de73860cda)
2025-10-14 00:38:28 +02:00
Tim Kientzle 82e31ba4a9 Merge pull request #2749 from KlaraSystems/des/tempdir
Unify temporary directory handling

(cherry picked from commit d207d816d0)
2025-10-14 00:38:23 +02:00
Martin Matuška 200ae00a12 Merge pull request #2722 from dependabot
CI: Bump the all-actions group across 1 directory with 3 updates

(cherry picked from commit 46fe318edd)
2025-10-11 22:13:37 +02:00
Tim Kientzle 78731e288a Merge pull request #2746 from pbrisbin/patch-1
Fix invalid quoting in archive_entry_paths.3

(cherry picked from commit 582799ee57)
2025-10-11 22:07:46 +02:00
Tim Kientzle 400abd1d7f Merge pull request #2740 from dunhor/gnutar_longpath_unicode
Check WCS pathname in header_gnutar before overwriting

(cherry picked from commit fda50c79ba)
2025-10-11 22:07:36 +02:00
Tim Kientzle 94817fa277 Merge pull request #2729 from KlaraSystems/des/leak-on-fatal
Don't leak memory on fatal error

(cherry picked from commit 372e709c1a)
2025-10-11 22:07:26 +02:00
Tim Kientzle 7c0980ee6c Merge pull request #2742 from bradking/parse-date-2038
parse_date: handle dates in 2038 and beyond if time_t is big enough

(cherry picked from commit 4ecf62fbd7)
2025-10-11 22:07:17 +02:00
Tim Kientzle e3cb54b42b Merge pull request #2741 from e-kwsm/extra-semi
fix: remove extra ';' outside of functions
(cherry picked from commit c34ff01c02)
2025-10-11 22:07:04 +02:00
Tim Kientzle 53e8522453 Merge pull request #2734 from kientzle/kientzle-ignore-too-long-gzip-filename
Ignore over-long gzip filename

(cherry picked from commit 39dc43b3e0)
2025-09-23 22:59:59 +02:00
Martin Matuška a6d47272af Merge pull request #2735 from kientzle/kientzle-err.h-conflict
Rename err.h to avoid conflict with system header

(cherry picked from commit ab5cb61f49)
2025-09-23 22:59:50 +02:00
Martin Matuška dc6ea847e1 Merge pull request #2731 from mmatuska/fix/macosci
CI: add workaround for cmake installed from local/pinned tab on GH/MacOS
(cherry picked from commit 38debf6be1)
2025-09-23 22:59:45 +02:00
Martin Matuška ec91352d64 Merge pull request #2732 from mmatuska/fix/safe-dir-over-reg-win
win: add complementary safe writes fix for Windows to 27588eba5 (#2477)
(cherry picked from commit e1dea559c7)
2025-09-23 22:59:40 +02:00
Martin Matuška 1b5e6d4aed Merge pull request #2670 from benoit-pierre/pr/fix_zip_writing_with_zstd_compression_method
zip: fix writing with ZSTD compression
(cherry picked from commit 589659ed7f)
2025-09-23 22:59:30 +02:00
Martin Matuška 927dd43020 Merge pull request #2477 from jrtc27/safe-dir-over-reg
Fix replacing a regular file with a dir for ARCHIVE_EXTRACT_SAFE_WRITES

(cherry picked from commit 52db141ece)
2025-09-23 22:59:25 +02:00
Martin Matuška 8055fbd321 Merge pull request #2686 from stoeckmann/lseek_win_regression
Fix Windows off_t handling

(cherry picked from commit 3b1100f9a9)
2025-09-23 22:59:21 +02:00
Martin Matuška 044dd73668 Merge pull request #2710 from meecash/CVE-2025-25724-check_strftime_result
Fix CVE-2025-25724 by checking the result of the strftime

(cherry picked from commit 6bd863f612)
2025-09-23 22:59:15 +02:00
Tim Kientzle af9e8bf368 Merge pull request #2717 from peakschris/cb_windows
bsdtar: Allow @filename to have CRLF endings
(cherry picked from commit 53135ca48e)
2025-09-23 22:58:57 +02:00
Tim Kientzle f162db9618 Merge pull request #2707 from fdegros/close_range_support
Avoid leaking file descriptors into subprocesses

(cherry picked from commit ab4d21e4cb)
2025-09-23 22:58:40 +02:00
Tim Kientzle 53d2bc4f89 Merge pull request #2696 from al3xtjames/mkstemp
Fix mkstemp path in setup_mac_metadata

(cherry picked from commit 892f331450)
2025-09-23 22:58:27 +02:00
Martin Matuška 44681dd67f Merge pull request #2723 from KlaraSystems/des/couldnt-visit
archive_read_disk_posix: Don't pass -1 to a function expecting errno

(cherry picked from commit bf50fe0538)
2025-09-23 22:58:19 +02:00
Martin Matuška ab5ae538f6 Merge pull request #2716 from antekone/bug/GH-2714/infinite-loop/1
RAR5 reader: early fail when file declares data for a dir entry

(cherry picked from commit 2db13f7422)
2025-09-23 22:58:12 +02:00
Martin Matuška 12c8b3f895 Merge pull request #2713 from antekone/bug/GH-2711/crash-when-rr/1
RAR5 reader: fix multiple issues in extra field parsing function

(cherry picked from commit 93f9e93d73)
2025-09-23 22:58:07 +02:00
Martin Matuška 5797a13c1f Merge pull request #2700 from mostynb/avoid_libxml2_deprecation_warnings
xar: avoid libxml2 deprecation warnings
(cherry picked from commit 12ffcef28c)
2025-09-23 22:58:01 +02:00
Tim Kientzle 31b219bffa Merge pull request #2712 from KlaraSystems/des/readdir_r
Drop support for readdir_r()

(cherry picked from commit 3bf1035e67)
2025-09-23 22:57:46 +02:00
Tim Kientzle 10ab6874cb Merge pull request #2704 from kientzle/kientzle-harden-append-acl
Guard against invalid type arguments

(cherry picked from commit 6062470cbc)
2025-09-23 22:57:35 +02:00
Tim Kientzle a4a65701f4 Merge pull request #2699 from mostynb/7z_eopm_reference
7z: add liblzma EOPM reference
(cherry picked from commit cc97338239)
2025-09-23 22:57:25 +02:00
Tim Kientzle 45849e410b Merge pull request #2697 from Kraust/topic/cmake_build_fixes
Allow Compiling Against Static CRT.

(cherry picked from commit cb6b9e9a28)
2025-09-23 22:57:10 +02:00
Tim Kientzle 80815b7a18 Merge pull request #2694 from stoeckmann/cleanups
Perform various cleanups

(cherry picked from commit 267042ebc7)
2025-09-10 10:19:09 +02:00
Tim Kientzle 51b5ac2f11 Merge pull request #2691 from kientzle/kientzle-issue2681
Add missing test file

(cherry picked from commit d06700a098)
2025-09-10 10:18:49 +02:00
Tim Kientzle dabc205b20 Merge pull request #2664 from fedegiova/fix_leak_for_cb_error
Fix a memory leak if write callback error early

(cherry picked from commit 595fb29e4c)
2025-09-10 10:18:13 +02:00
Tim Kientzle de09764140 Merge pull request #2658 from stoeckmann/skip_tests
Skip tests if respective support is missing

(cherry picked from commit 609d8122f1)
2025-09-10 10:18:05 +02:00
Tim Kientzle 1f27094c78 Merge pull request #2673 from 004helix/master
archive_cryptor_private.h: check message digest functions are enabled for windows

(cherry picked from commit 31cff981e4)
2025-09-10 10:17:55 +02:00
Tim Kientzle 57168d660b Merge pull request #2679 from AZero13/error
Handle possible errors from system calls

(cherry picked from commit d8aaf88c9f)
2025-09-10 10:17:39 +02:00
Tim Kientzle 1cab1650fd Merge pull request #2687 from hemant-jadhav-emerson/master
Supress restrict keyword for msc_ver older than 1927

(cherry picked from commit ee49ac8106)
2025-09-10 10:17:27 +02:00
Tim Kientzle dafb79b967 Merge pull request #2689 from ElvishJerricco/linux-fs-flags
clear_nochange_fflags: Use linux FS flags

(cherry picked from commit 9fe18ba0a6)
2025-09-10 10:17:17 +02:00
Tim Kientzle bb6b6d20cf Merge pull request #2684 from DHowett/dev/duhowett/shim_open
win32: shim wopen, and make both open/wopen use _s "secure" variant
(cherry picked from commit cd020d1ccb)
2025-09-10 10:17:07 +02:00
Tim Kientzle 7a15e83449 Merge pull request #2688 from stoeckmann/entry_off32
Ignore sizes which do not fit into off_t

(cherry picked from commit a474bab7e3)
2025-09-10 10:16:55 +02:00
Tim Kientzle 42371f7236 Merge pull request #2672 from AZero13/ferror
Fix error checking in writing files

(cherry picked from commit ffde04f272)
2025-09-10 10:16:44 +02:00
Tim Kientzle 0c491a75ca Merge pull request #2678 from mostynb/zstd_filter_checksum
Enable Zstandard's checksum feature in the zstd write filter

(cherry picked from commit a218a52dbb)
2025-09-10 10:16:33 +02:00
Tim Kientzle f75fb1a13f Merge pull request #2677 from AZero13/fwrite
Change error message from "fwrite function failed" to "write function failed"

(cherry picked from commit e4978e2edd)
2025-09-10 10:16:18 +02:00
Tim Kientzle affb84375d Merge pull request #2676 from danyeaw/fix-pkgconf-path
Fix .pc location when CMAKE_INSTALL_LIBDIR not set

(cherry picked from commit 6a252c84a2)
2025-09-10 10:16:00 +02:00
Martin Matuška 2aaa3389d1 Merge pull request #2659 from stoeckmann/chld
Improve filter process handling

(cherry picked from commit 6effe2ec6b)
2025-09-10 10:15:45 +02:00
Martin Matuška 0d32537a91 Merge pull request #2669 from benoit-pierre/pr/minor_test_related_tweaks
minor test related tweaks

(cherry picked from commit 251f7e839c)
2025-09-10 10:15:07 +02:00
Martin Matuška 7278794021 Merge pull request #2663 from stoeckmann/filename_errpath
open_filename: Free memory on error paths

(cherry picked from commit 47bdf82489)
2025-09-10 10:14:59 +02:00
Martin Matuška 0fadc61d5b Merge pull request #2665 from stoeckmann/read_data_sparse
archive_read_data: Handle sparse holes at end of file correctly

(cherry picked from commit c3be70e071)
2025-09-10 10:14:46 +02:00
Martin Matuška f0020dcb21 Merge pull request #2668 from stoeckmann/7z_oob
7zip: Fix out of boundary access
(cherry picked from commit 9bdc5b82f7)
2025-09-10 10:14:34 +02:00
Tim Kientzle 7a32f7f9b1 Merge pull request #2662 from stoeckmann/set_format_strcpy
archive_read_set_format: Remove strcpy calls

(cherry picked from commit 0931c12b7e)
2025-09-10 10:13:22 +02:00
Tim Kientzle a7a864bc1b Merge pull request #2660 from kevans91/ke/fix-fortify
libarchive/test: fix build when memcpy() is a macro

(cherry picked from commit a8f93f2480)
2025-09-10 10:12:39 +02:00
Tim Kientzle 56914db37f Merge pull request #2655 from mmatuska/fix/setclocale
test_utils/test_main.c: satisfy -Wstrict-prototypes

(cherry picked from commit 0f9a06d6ab)
2025-09-10 10:12:05 +02:00
Martin Matuska 9525f90ca4 Release 3.8.1 2025-06-01 21:26:44 +02:00
Martin Matuška 7a0b0caea1 Merge pull request #2627 from heirecka/do-not-hard-code-pkg-config
Use PKG_CONFIG instead of hard-coded pkg-config

(cherry picked from commit 70978468e9)
2025-05-31 21:40:54 +02:00
Martin Matuška bc2fcdafce Merge pull request #2643 from stoeckmann/tar_pax_sparse
tar: Handle extra bytes after sparse entries
(cherry picked from commit c7b7bd7c0e)
2025-05-31 21:32:50 +02:00
Tim Kientzle 14de0d62d3 Merge pull request #2652 from stoeckmann/wstring_ensure
Check archive_wstring_ensure return value

(cherry picked from commit 8d074302ac)
2025-05-31 21:25:32 +02:00
Tim Kientzle 8e1092726c Merge pull request #2651 from stoeckmann/string_ensure_check
Always check archive_string_ensure return value

(cherry picked from commit 101230094c)
2025-05-31 21:25:32 +02:00
Tim Kientzle 94208dc524 Merge pull request #2648 from stoeckmann/test_en_us
test_utils: Enforce C locale for all tests

(cherry picked from commit 8540cb7cfb)
2025-05-31 21:25:32 +02:00
Tim Kientzle 6050823986 Merge pull request #2650 from stoeckmann/string_sort
archive_utility_string_sort: Use qsort directly

(cherry picked from commit e2eda9e68b)
2025-05-31 21:25:32 +02:00
Tim Kientzle 95a8adc7e5 Merge pull request #2634 from stoeckmann/tar_neg_time
tar: Support negative time values with pax
(cherry picked from commit 9b07a143ee)
2025-05-31 21:25:32 +02:00
Tim Kientzle 3e718bf2d4 Merge pull request #2649 from stoeckmann/compress_recursion
compress: Prevent call stack overflow
(cherry picked from commit cd5c44c5d0)
2025-05-31 21:25:32 +02:00
Tim Kientzle 0dc4f71fcb Merge pull request #2642 from stoeckmann/seek_regress
Fix FILE_skip regression

(cherry picked from commit 59b09796c3)
2025-05-31 21:25:32 +02:00
Tim Kientzle b92f70d190 Merge pull request #2644 from stoeckmann/tar_neg_size
tar: Always treat negative sizes as error
(cherry picked from commit d261f46ae5)
2025-05-31 21:25:32 +02:00
Tim Kientzle ab1d9a37eb Merge pull request #2645 from stoeckmann/tar_formatter
tar: Fix archive_set_error formatters
(cherry picked from commit dcdd7338d6)
2025-05-31 21:25:32 +02:00
Tim Kientzle 119aec5306 Merge pull request #2646 from stoeckmann/sparse32
tar: Handle many sparse comments on 32 bit systems
(cherry picked from commit 702f31a01c)
2025-05-31 21:25:32 +02:00
Tim Kientzle ebbd18c365 Merge pull request #2640 from robUx4/xml-uuid
[cmake] add uuid library when using xmllite

(cherry picked from commit 6389d172ed)
2025-05-31 21:25:32 +02:00
Tim Kientzle 6445be4ea6 Merge pull request #2637 from stoeckmann/pax_nl
tar: Keep block alignment after pax error
(cherry picked from commit 341dd5d1d4)
2025-05-31 21:25:32 +02:00
Tim Kientzle 30e662a0a5 Merge pull request #2639 from stoeckmann/sprintf_ll
Add ll length modifier to archive_string_vsprintf

(cherry picked from commit 18d456377e)
2025-05-31 21:25:32 +02:00
Tim Kientzle 66b380ed5a Merge pull request #2636 from zhaofengli/reset-header-state-after-mac-metadata
tar: Reset accumulated header state after reading macOS metadata blob
(cherry picked from commit b6e1f06457)
2025-05-31 21:25:32 +02:00
Tim Kientzle ad4d2eefa8 Merge pull request #2630 from stoeckmann/wincrypt_casts
Fix archive_wincrypt_version

(cherry picked from commit 42c2f84649)
2025-05-31 21:25:32 +02:00
Tim Kientzle 8a3cdd71cb Merge pull request #2633 from stoeckmann/match_cleanup
archive_match: Simplify and clean up code

(cherry picked from commit 6dbea2df3b)
2025-05-31 21:25:32 +02:00
Tim Kientzle 22ef0ee13e Merge pull request #2632 from stoeckmann/cygwin_definition
Prefer __CYGWIN__ over CYGWIN definition

(cherry picked from commit cdc185e917)
2025-05-31 21:25:32 +02:00
Tim Kientzle 4937278516 Merge pull request #2631 from stoeckmann/configure_windows
configure.ac: Improve Windows version detection

(cherry picked from commit 0ed4435209)
2025-05-31 21:25:32 +02:00
Tim Kientzle 97a48a0d79 Merge pull request #2509 from tesap/install-lib-dir
Make installation lib dir depend on CMAKE_INSTALL_LIBDIR variable

(cherry picked from commit 992734d6cc)
2025-05-31 21:25:32 +02:00
Tim Kientzle 53c7eb8adf Merge pull request #2629 from mmatuska/fix/versiontest
tests: accept underscore in arbitrary third-party version strings
(cherry picked from commit 627ba5bbbf)
2025-05-31 21:25:32 +02:00
Martin Matuska 70ff28fcf0 Release 3.8.0 2025-05-20 10:35:52 +02:00
dependabot[bot] 714e357b97 CI: Bump the all-actions group across 1 directory with 4 updates (#2623)
Bumps the all-actions group with 4 updates:
`actions/checkout` from 4.2.1 to 4.2.2
`actions/upload-artifact` from 4.4.3 to 4.6.2
`github/codeql-action` from 3.26.12 to 3.28.18
`ossf/scorecard-action` from 2.4.0 to 2.4.1
2025-05-20 10:19:56 +02:00
Mostyn Bramley-Moore d80d734190 Add some more error checking to shell scripts (#2617)
Exit immediately if a command exits with a non-zero status, and treat
unset variables as an error when substituting.
2025-05-20 10:14:17 +02:00
Tim Kientzle 352b710754 Merge pull request #2612 from AZero13/okay-what
Fatal if field[0].start is null
2025-05-19 19:39:10 -07:00
Tim Kientzle 6976a252aa Merge pull request #2622 from AZero13/calculate-size
Calculate size of arrays instead of assuming they are always 6
2025-05-19 19:38:04 -07:00
Tim Kientzle a4f0571fb6 Merge pull request #2621 from AZero13/redundant-s
*s != '\0' is redundant
2025-05-19 19:36:57 -07:00
Tim Kientzle b921c8673b Merge pull request #2619 from AZero13/patch-2
days should be a long type
2025-05-19 19:34:24 -07:00
Tim Kientzle 2c1ee4d2b1 Merge pull request #2618 from AZero13/patch-1
Label error and errorx as __LA_NORETURN
2025-05-19 19:32:32 -07:00
Rose 9f4c179c3f Calculate size of arrays instead of assuming they are always 6 2025-05-19 15:22:56 -04:00
Rose fd2130b970 *s != '\0' is redundant
Not that this does anything to codegen probably, but it is still redundant.
2025-05-19 15:16:18 -04:00
Rose bde1c16393 Fatal if field[0].start or field[0].end is null
We should not get here, but given that the check exists, we should not let it happen if this is NULL because otherwise we just dereference it later on.
2025-05-19 14:35:45 -04:00
AZero13 b1348fbfab days should be a long type
The difference in years is cast to a long and then multiplied by 365. The return value of the function is also a long.
2025-05-19 13:39:32 -04:00
AZero13 cfc1f3a9da Label error and errorx as __LA_NORETURN
This also prevents clang-tidy from reporting some false bugs.
2025-05-19 13:35:19 -04:00
Tim Kientzle 17a63c7e35 Merge pull request #2611 from zhaofengli/fix-iconv-pc
autotools: Fix iconv issues in generated .pc file
2025-05-18 15:44:48 -07:00
Tim Kientzle 51793de834 Merge pull request #2613 from mmatuska/fix/7zipsfx-2
7z: fix another out-of-bounds read in 7z SFX archive detection
2025-05-18 15:41:26 -07:00
Tim Kientzle 23f414385e Merge pull request #2616 from mostynb/contrib_psota-benchmark_tcp_sh_bash
contrib/psota-benchmark/tcp.sh is a bash script
2025-05-18 15:26:17 -07:00
Tim Kientzle 0a4e506f3e Merge pull request #2614 from AZero13/tar-2
Assign a result when failure happens
2025-05-18 15:25:11 -07:00
Tim Kientzle 3b4bf62fbd Merge pull request #2600 from nvinson/master
Copy ae digests to mtree_entry
2025-05-18 14:59:36 -07:00
Mostyn Bramley-Moore fe41cec3da Remove long-unused travis CI script (#2615)
Support for travis CI was removed in 2019, this script hasn't been used
since.
2025-05-18 18:55:32 +02:00
Mostyn Bramley-Moore ead8cd69bd contrib/psota-benchmark/tcp.sh is a bash script
I am unsure if this is still used, but it fails to run in Bourne shell.
2025-05-18 12:58:31 +02:00
Rose 5c61984652 Assign a result when failure happens
In some places, result is checked even after failure, so let's assign a result.
2025-05-17 21:24:51 -04:00
Martin Matuska 3128f04f58 7z: fix another out-of-bounds read in 7z SFX archive detection
When looping over program header entries (e_shnum)
we need to increment sec_tbl_offset by e_shentsize
and not by fixed values.

Fixes OSS-Fuzz issue 418349489
2025-05-18 03:07:49 +02:00
Tim Kientzle fbd168bd2a Merge pull request #2610 from stoeckmann/string_int_size_t
archive_string: Check values before casts
2025-05-17 17:15:03 -07:00
Zhaofeng Li 6b2c5e0ba4 autotools: Fix iconv issues in generated .pc file
The goal is to make everyone (including msys2) happy.

Fixes #1766 and #1819.

Signed-off-by: Zhaofeng Li <hello@zhaofeng.li>
2025-05-17 13:50:16 -06:00
Tim Kientzle fc4964751f Merge pull request #2609 from stoeckmann/safe_fprintf
tar: Handle more edge cases in safe_fprintf
2025-05-17 11:46:32 -07:00
Nicholas Vinson 6dd27bc4a3 test_utils/test_main.c: increase logfilename bf sz
Increase logfilename buffer size from 64 to 256. This aligns the buffer
size with the size limits found in Windows and Linux.
2025-05-17 11:45:20 -04:00
Nicholas Vinson 0e88bc1ecc Replace struct ae_mset_digest with uint_least32_t
Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
2025-05-17 11:33:15 -04:00
Nicholas Vinson ea49bb3057 Copy ae digests to mtree_entry
Copy ae digests to mtree_entry. This simplifies porting non-archive
    formats to archive formats while preserving supported message
    digests specifically in cases where recomputing digests is not
    viable.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
2025-05-17 11:33:15 -04:00
Tobias Stoeckmann 7b0c8a62cc archive_string: Check values before casts
The size_t to int conversion is especially required on Windows systems
to support their int-based functions. These variables should be properly
checked before casts. This avoids integer truncations with large
strings.

I prefer size_t over int for sizes and adjusted variables to size_t
where possible to avoid casts.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-17 10:42:51 +02:00
Tim Kientzle 981fd9afed Merge pull request #2604 from mmatuska/fix/7zipsfx
7z: fix out-of-bounds read in 7z self extracting archive detection
2025-05-16 16:40:24 -07:00
Tim Kientzle 1b9c075735 Merge pull request #2607 from zhaofengli/disallow-multiple-files-from
bsdtar: Disallow multiple --files-from/-T options
2025-05-16 15:49:16 -07:00
Tobias Stoeckmann c2d06848ea tar: Make safe_fprintf more platform independent
If vsnprintf fails with errno EOVERFLOW, the results are very platform
dependent but never useful. The implementation in glibc fills bytes with
blanks, FreeBSD fills them with zeros, OpenBSD and Windows set first
byte to '\0'.

Just stop processing and don't print anything, which makes it follow
the OpenBSD and Windows approach.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-17 00:23:01 +02:00
Tobias Stoeckmann f3f2aaf0ac tar: Fix safe_fprintf comment
The stack buffer is never used for out of memory messages.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-17 00:23:01 +02:00
Tobias Stoeckmann d1a260932c tar: Support large strings in safe_fprintf
The vsnprintf calls might return INT_MAX with very long strings.
Prevent a signed integer overflow when taking an additional nul
byte into account.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-17 00:23:00 +02:00
Tobias Stoeckmann 0e15b864c1 tar: Always use correct length in safe_fprintf
If the format buffer shall not be further increased in size, the
length value mistakenly takes the terminating nul byte into account.

This is in contrast to a successful vsnprintf call.

Also use the correct string length if fallback to stack buffer is
required.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-17 00:22:15 +02:00
Tobias Stoeckmann 3f1e45d146 tar: Clear safe_fprintf stack before usage
The stack buffer is never cleared, which can become an issue depending
on vsnprintf implementation's behavior if -1 is returned. The code
would eventually fall back to stack buffer which might be not
nul terminated.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-16 23:50:27 +02:00
AZero13 c7203f805d 7z: Free the file if compression-level option is invalid (#2608)
Otherwise, the file is leaked.
2025-05-16 23:41:18 +02:00
Zhaofeng Li 00d559e4b9 bsdtar: Disallow multiple --files-from/-T options 2025-05-16 11:35:36 -06:00
Tim Kientzle 428167e750 Merge pull request #2606 from zhaofengli/parse-unix-epoch-date
Support @-prefixed Unix epoch timestamps as date strings
2025-05-15 18:06:03 -07:00
Zhaofeng Li 6b97a57e8e Support @-prefixed Unix epoch timestamps as date strings
Signed-off-by: Zhaofeng Li <hello@zhaofeng.li>
2025-05-15 09:59:33 -06:00
Zhaofeng LiandDustin L. Howett c26f037745 bsdtar: Support --mtime and --clamp-mtime (#2601)
Hi,

This PR adds support for setting a forced mtime on all written files
(`--mtime` and `--clamp-mtime`) in bsdtar.

The end goal will be to support all functionalities in
<https://reproducible-builds.org/docs/archives/#full-example>, namely
`--sort` and disabling other attributes (atime, ctime, etc.).

Fixes #971.

## History

- [v1](https://github.com/zhaofengli/libarchive/tree/forced-mtime-v1):
Added `archive_read_disk_set_forced_mtime` in libarchive. As a result,
it was only applied when reading from the filesystem and not from other
archives.
- [v2](https://github.com/zhaofengli/libarchive/tree/forced-mtime-v2):
Refactored to apply the forced mtime in `archive_write`.
- v3 (current): Reduced libarchive change to exposing
`archive_parse_date`, moved clamping logic into bsdtar.

---------

Signed-off-by: Zhaofeng Li <hello@zhaofeng.li>
Co-authored-by: Dustin L. Howett <dustin@howett.net>
2025-05-15 14:08:14 +02:00
Marcus TillmannsandMartin Matuška 84ac71335f Allow setting the original filename for gzip compressed files (#2544)
Co-authored-by: Martin Matuška <martin@matuska.de>
2025-05-15 14:07:48 +02:00
Moroshima 293c8bb992 correct only modes of --no-mac-metadata in bsdtar.1 (#2597)
`--no-mac-metadata` is c, r, u and x mode only
2025-05-15 12:59:37 +02:00
James Hilliard 63d7c24eea Fix mbedtls version 3 compatibility (#2602)
We need to use the new API for mbedtls 3 compatibility

Fixes #2025

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2025-05-15 12:56:59 +02:00
AZero13 b50b8a42f6 safe_printf should annotate with restrict (#2605)
printf has restrict for its parameters, and safe_printf should do the
same.
2025-05-14 18:24:54 -07:00
Martin Matuska 1667b31d0b 7z: fix out-of-bounds read in 7z self extracting archive detection
Fixes OSS-Fuzz issue 416832167
2025-05-14 16:18:19 +02:00
Tobias StoeckmannandTim Kientzle a612bf62f8 rar: Fix heap-buffer-overflow (#2599)
A filter block size must not be larger than the lzss window, which is
defined
by dictionary size, which in turn can be derived from unpacked file
size.

While at it, improve error messages and fix lzss window wrap around
logic.

Fixes https://github.com/libarchive/libarchive/issues/2565

---------

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Co-authored-by: Tim Kientzle <kientzle@acm.org>
2025-05-11 19:00:11 +02:00
Tobias Stoeckmann 09685126fc rar: Fix double free with over 4 billion nodes (#2598)
If a system is capable of handling 4 billion nodes in memory, a double
free could occur because of an unsigned integer overflow leading to a
realloc call with size argument of 0. Eventually, the client will
release that memory again, triggering a double free.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-10 17:17:19 -07:00
c8dc3bcb47 7z sfx overaly detection (#2088)
To detect 7z SFX files, libarchive currently searches for the 7z header
in a hard-coded addr range of the PE/ELF file
(specified via macros SFX_MIN_ADDR and SFX_MAX_ADDR). This causes it to
miss SFX files that may stray outside these values (libarchive fails to
extract 7z SFX ELF files created by recent versions of 7z tool because
of this issue). This patch fixes the issue by finding a more robust
starting point for the 7z header search: overlay in PE or the .data
section in ELF. This patch also adds 3 new test cases for 7z SFX to
libarchive.

Fixes https://github.com/libarchive/libarchive/issues/2075

---------

Co-authored-by: Masoud Mehrabi Koushki <masoud.mehrabi.koushki1@huawei.com>
Co-authored-by: Martin Matuška <martin@matuska.de>
2025-05-09 19:21:32 +02:00
Mostyn Bramley-Moore 5d2a788e41 7zip reader: add test for POWERPC filter support for LZMA compressor (#2460)
This new test archive contains a C hello world executable built like so
on a ubuntu 24.04 machine:
```
int main(int argc, char *argv[]) {
  printf("hello, world\n");
  return 0;
}
```

`powerpc-linux-gnu-gcc hw.c -o hw-powerpc -Wall`

The test archive that contains this executable was created like so,
using 7-Zip 24.08: `7zz a -t7z -m0=lzma2 -mf=ppc
libarchive/test/test_read_format_7zip_lzma2_powerpc.7z hw-powerpc`

The new test archive is required because the powerpc filter for lzma is
implemented in liblzma rather than in libarchive.
2025-05-09 13:40:56 +02:00
Dustin L. Howett 16fd043f51 xar: add xmllite support to the XAR reader and writer (#2388)
This commit adds support for reading and writing XAR archives on Windows
using the built-in xmllite library. xmllite is present in all versions
of Windows starting with Windows XP.

With this change, no external XML library (libxml2, expat) is required
to read or produce XAR archives on Windows.

xmllite is a little bit annoying in that it's entirely a COM API--the
likes of which are annoying to use from C.

Signed-off-by: Dustin L. Howett <dustin@howett.net>
Depends on e619342dfa
Closes #1811
2025-05-09 13:40:21 +02:00
Tim Kientzle 1ba83d4b3f Polish for GNU tar format reading/writing (#2455)
A few small tweaks to improve reading/writing of the legacy GNU tar
format.

* Be more tolerant of redundant 'K' and 'L' headers
* Fill in missing error messages for redundant headers
* New test for reading archive with redundant 'L' headers
* Earlier identification of GNU tar format in some cases

These changes were inspired by Issue #2434. Although that was determined
to not technically be a bug in libarchive, it's relatively easy for
libarchive to tolerate duplicate 'K' and 'L' headers and we should be
issuing appropriate error messages in any case.
2025-05-09 13:36:05 +02:00
Tobias Stoeckmann 1d7eadf417 Fix archive_time.c issues (concurrency, 32 bit) (#2563)
The refactoring of https://github.com/libarchive/libarchive/pull/2553
introduced three issues:

1. Introduction of a modifiable global static variable

This violates the goal of having no global variables as stated in [the
README.md](https://github.com/libarchive/libarchive/blob/b6f6557abb8235f604eced6facb42da8c7ab2a41/README.md?plain=1#L195)
which in turn leads to concurrency issues. Without any form of mutex
protection, multiple threads are not guaranteed to see the correct
min/max values. Since these are not needed in regular use cases but only
in edge cases, handle them in functions with local variables only.

Also the global variables are locale-dependent which can change during
runtime. In that case, future calls leads to issues.

2. Broken 32 bit support

The writers for zip and others affected by the previously mentioned PR
and test-suite on Debian 12 i686 are broken, because the calculation of
maximum MS-DOS time is not possible with a 32 bit time_t. Treat these
cases properly.

3. Edge case protection

Huge or tiny int64_t values can easily lead to unsigned integer
overflows. While these do not affect stability of libarchive, the
results are still wrong, i.e. are not capped at min/max as expected.

In total, the functions are much closer to their original versions again
(+ more range checks).

---------

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-09 13:33:32 +02:00
Tobias Stoeckmann 3e4683f5c4 rar: Check packed_size constraints (#2591)
Make sure that size_t casts do not truncate the value of packed_size on
32 bit systems since it's 64 bit. Extensions to RAR format allow 64 bit
values to be specified in archives.

Also verify that 64 bit signed arithmetics do not overflow.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-09 13:31:24 +02:00
Tobias Stoeckmann 2b8db0f82d rar: Fix rar_read_ahead call stack overflow (#2592)
It is possible to trigger a call stack overflow by repeatedly entering
the rar_read_ahead function. In normal circumstances, this recursion is
optimized away by common compilers, but default settings with MSVC keep
the recursion in place. Explicitly turn the recursion into a goto-loop
to avoid the overflow even with no compiler optimizations.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-09 13:31:00 +02:00
Tobias Stoeckmann 4f4e0e4b70 rar: Clean up br on split archive entries (#2593)
Reset avail_in and next_in if the next entry of a split archive is
parsed to always update its internal structure to access next bytes when
cache runs empty.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-09 13:30:32 +02:00
Tobias Stoeckmann e744746cc1 rar: Support large headers on 32 bit systems (#2596)
Support header sizes larger than 32 bit even on 32 bit systems, since
these normally have large file support. Otherwise an unsigned integer
overflow could occur, leading to erroneous parsing on these systems.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-09 13:29:53 +02:00
Tobias Stoeckmann 761e2f3c1e Unify spacing in archive_read_support_format_rar.c (#2590)
Most source files use tabs instead of spaces, but
archive_read_support_format_rar.c uses spaces most of the time. A few
lines contain a mixture of tabs and spaces, which leads to poorly
formatted output with many default settings.

Unify the style. No functional change and preparation for upcoming
changes to get rid of white space diffs.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-04-27 16:22:34 -07:00
Tim Kientzle 966010ce79 Improve support for AFIO 64-bit inode values (#2589)
PR #2258 hardened AFIO parsing by converting all inode values >= 2^63 to
zero values. This turns out to be problematic for filesystems that use
very large inode values; it results in all such files being viewed as
hardlinks to each other.

PR #2587 partially addressed this by instead considering inode values >=
2^63 as invalid and just ignoring them. This prevented the accidental
hardlinking, but at the cost of losing all hardlinks that involved large
inode values.

This PR further improves things by stripping the high order bit from
64-bit inode values in the AFIO parser. This allows them to be mostly
preserved and should allow hardlinks to get properly processed in the
vast majority of cases. The only false hardlinks would be when there are
inode values that differ exactly in the high order bit, which should be
very rare.

A full solution will require expanding inode handling to use unsigned
64-bit values; we can't do that without a major version bump, but this
PR also sets the stage for migrating inode support in a future
libarchive 4.0.
2025-04-26 16:10:45 -07:00
Brian Campbell 7c02cde37a Fix overflow in build_ustar_entry (#2588)
The calculations for the suffix and prefix can increment the endpoint
for a trailing slash. Hence the limits used should be one lower than the
maximum number of bytes.

Without this patch, when this happens for both the prefix and the
suffix, we end up with 156 + 100 bytes, and the write of the null at the
end will overflow the 256 byte buffer. This can be reproduced by running
```
mkdir -p foo/bar
bsdtar cvf test.tar foo////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////bar
```
when bsdtar is compiled with Address Sanitiser, although I originally
noticed this by accident with a genuine filename on a CHERI capability
system, which faults immediately on the buffer overflow.
2025-04-25 21:11:19 -07:00
Dmitry Ivankov be8d08868c bsdtar: don't hardlink negative inode files together (#2587)
It seems that valid inode can be 64-bit and negative (or rather outside
of 64-bit signed range)


https://github.com/freebsd/freebsd-src/blob/a60615d5be83ca050d4ddfbbb4411ca7a8a11486/sys/sys/_types.h#L124
https://github.com/torvalds/linux/blob/7e74f756f5f643148ca5537bf2fee6767e4b0ed9/include/linux/types.h#L22

But signed type is used in libarchive and there were some fuzzing issues
with it, https://github.com/libarchive/libarchive/pull/2258 converts
negative `ino` to `0`, which is actually a reserved inode value, but
more importantly it was still setting `AE_SET_INO` flag and later on
hardlink detection will treat all `0` on same `dev` as hardlinks to each
other if they have some hardlinks.

This showed up in BuildBarn FUSE filesystem
https://github.com/buildbarn/bb-remote-execution/issues/162 which has
both
- setting number of links to a big value
- generating random inode values in full uint64 range

Which in turn triggers false-positive hardlink detection in `bsdtar`
with high probability.

Let's mitigate it
- don't set `AE_SET_INO` on negative values (assuming rest of code isn't
ready to correctly handle full uint64 range)
- check that `ino + dev` are set in link resolver
2025-04-22 07:29:44 -07:00
Tobias Stoeckmann dcbf1e0ede Do not skip past EOF while reading (#2584)
Make sure to not skip past end of file for better error messages. One
such example is now visible with rar testsuite. You can see the
difference already by an actually not useless use of cat:

```
$ cat .../test_read_format_rar_ppmd_use_after_free.rar | bsdtar -t
bsdtar: Archive entry has empty or unreadable filename ... skipping.
bsdtar: Archive entry has empty or unreadable filename ... skipping.
bsdtar: Truncated input file (needed 119 bytes, only 0 available)
bsdtar: Error exit delayed from previous errors.
```

compared to

```
$ bsdtar -tf .../test_read_format_rar_ppmd_use_after_free.rar
bsdtar: Archive entry has empty or unreadable filename ... skipping.
bsdtar: Archive entry has empty or unreadable filename ... skipping.
bsdtar: Error exit delayed from previous errors.
```

Since the former cannot lseek, the error is a different one
(ARCHIVE_FATAL vs ARCHIVE_EOF). The piped version states explicitly that
truncation occurred, while the latter states EOF because the skip past
the end of file was successful.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-04-14 21:02:17 -07:00
Graham Percival f96497248e bsdtar: start "fake short equivalents" enum higher (#2586)
This avoids possible conflict with command-line options such as -B.
2025-04-14 11:39:14 -07:00
zhongfly 948a52d672 archive_version_details: add missing ';' at end of declaration (#2585)
Close #2579
2025-04-14 07:37:38 -07:00
Tobias Stoeckmann e1c8c9ef64 tar: Improve LFS support on 32 bit systems (#2582)
The size_t data type is only 32 bit on 32 bit sytems while off_t is
generally 64 bit to support files larger than 2 GB.

If an entry is declared to be larger than 4 GB and the entry shall be
skipped, then 32 bit systems truncate the requested amount of bytes.
This leads to different interpretation of data in tar files compared to
64 bit systems.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-04-13 11:07:18 -07:00
Graham Percival 8f49a18f64 Avoid some casts by changing the private API (#2578) 2025-04-12 13:58:03 -07:00
Graham Percival 992a596290 Fix missing newline at EOF (#2577) 2025-04-11 20:10:04 -07:00
AZero13 da6bc7bf27 i should be size_t (#2575)
The size of i does not matter, and a size_t is added to it, so to avoid
that truncation, just make i size_t. It also is passed as a size_t.
2025-04-10 20:14:55 -07:00
Lukas Javorsky 95c386317f Remove unnecessary sharutils dependency (#2571)
Resolves issue: #2570
2025-04-08 20:23:27 -07:00
ARJANEN Loïc Jean David 4c0b3618a4 Fixes Windows compile issue (#2538)
Solves a Windows compile issue when OpenSSH/mbedTLS/Nettle is activated
and on the build system's paths by making the Windows API backend higher
priority on Windows (meaning that only RIPEMD160 will use
OpenSSH/mbedTLS/Nettle anymore).

Fixes #2536 and starts on #2320.
2025-04-07 08:04:27 -07:00
Tobias Stoeckmann ef09372952 warc: Prevent signed integer overflow (#2568)
If a warc archive claims to have more than INT64_MAX - 4 content bytes,
the inevitable failure to skip all these bytes could lead to parsing
data which should be ignored instead.

The test case contains a conversation entry with that many bytes and if
the entry is not properly skipped, the warc implementation would read
the conversation data as a new file entry.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-04-06 15:24:13 -07:00
Graham Percival b580147278 Fix #endif comments for header guards (#2567) 2025-04-06 14:16:24 -07:00
Graham Percival ea9fd828dc Use __LA_MODE_T to avoid implicit int conversions (#2478) 2025-04-06 14:13:17 -07:00
Graham Percival 81c43ea168 Fix missing newline at EOF (#2566) 2025-04-06 13:38:06 -07:00
Tobias Stoeckmann 89b8c35ff4 Improve lseek handling (#2564)
The skip functions are limited to 1 GB for cases in which libarchive
runs on a system with an off_t or long with 32 bits. This has negative
impact on 64 bit systems.

Instead, make sure that _all_ subsequent functions truncate properly.
Some of them already did and some had regressions for over 10 years.

Tests pass on Debian 12 i686 configured with --disable-largefile, i.e.
running with an off_t with 32 bits.

Casts added where needed to still pass MSVC builds.

---------

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-04-06 13:34:37 -07:00
Graham Percival fed3712d6e Reject bad hex values in xar checksums (#2479)
Hex values should be A to F (and lower-case); if there's any other
letters, reject them.
2025-04-06 09:29:16 +02:00
Graham Percival 1b6009d17b Use explicit casts for some functions (#2480) 2025-04-06 09:26:53 +02:00
Tim Kientzle 29fd918e18 Issue 2548: Reading GNU sparse entries (#2558)
My attempt to fix #2404 just made the confusion between the size of the
extracted file and the size of the contents in the tar archive worse
than it was before.

@ferivoz in #2557 showed that the confusion stemmed from a point where
we were setting the size in the entry (which is by definition the size
of the file on disk) when we read the `GNU.sparse.size` and
`GNU.sparse.realsize` attributes (which might represent the size on disk
or in the archive) and then using that to determine whether to read the
value in ustar header (which represents the size of the data in the
archive).

The confusion stems from three issues:
* The GNU.sparse.* fields mean different things depending on the version
of GNU tar used.
* The regular Pax `size` field overrides the value in the ustar header,
but the GNU sparse size fields don't always do so.
* The previous libarchive code tried to reconcile different size
information as we went along, which is problematic because the order in
which this information appears can vary.

This PR makes one big structural change: We now have separate storage
for every different size field we might encounter. We now just store
these values and record which one we saw. Then at the end, when we have
all the information available at once, we can use this data to determine
the size on disk and the size in the archive.

A few key facts about GNU sparse formats:

* GNU legacy sparse format: Stored all the relevant info in an extension
of the ustar header.
* GNU pax 0.0 format: Used `GNU.sparse.size` to store the size on disk
* GNU pax 0.1 format: Used `GNU.sparse.size` to store the size on disk
* GNU pax 1.0 format: Used `GNU.sparse.realsize` to store the size on
disk; repurposed `GNU.sparse.size` to store the size in the archive, but
omitted this in favor of the ustar size field when that could be used.

And of course, some key precedence information:
* Pax `size` field always overrides the ustar header size field.
* GNU sparse size fields override it ONLY when they represent the size
of the data in the archive.

Resolves #2548
2025-03-30 09:26:25 -07:00
Christoph Grüninger 3a5a34b821 [cmake] Require CMake 3.17 or newer (#2556)
Remove code for older versions of CMake.
CMake 3.14 stopped running on Windows XP and Vista.

Fix detection of wcscmo, wcscpy, wcslen
2025-03-28 18:06:15 -07:00
ARJANEN Loïc Jean David 6bb0952602 Commonalising time-related functions. (#2553)
Putting the time format conversion functions in one file and using the
common functions in the various formats.
2025-03-28 07:23:43 -07:00
Christoph Grüninger 4237b476fd [cmake] Require minimum CMake version of 3.5 (#2555)
CMake 4.0 will be released soon and it refuses to accept a minimum
required version below 3.5 without additional flags.
2025-03-26 06:18:12 -07:00
ARJANEN Loïc Jean David 9ad0e27f53 Fix for the ZIP large file test (#2552)
Making the ZIP large file test use the utility functions too.
2025-03-24 19:20:21 -07:00
Peter Kokot 2c2266432f CMake: Replace CMAKE_COMPILER_IS_GNUCC with CMAKE_C_COMPILER_ID (#2550)
Hello,

- The `CMAKE_COMPILER_IS_*` variables are deprecated and
`CMAKE_C_COMPILER_ID` can be used in this case instead.
- The legacy `endif()` command argument also simplified to avoid
repeating the condition.
2025-03-22 14:21:38 -07:00
nia f8a34abfbb Only use S_ISSOCK if available. (#2543)
Needed to build on OpenServer 5 Definitive 2018.
2025-03-18 06:17:03 -07:00
Nicholas Vinson a323e5fa68 Move archive_entry_set_digest() to public API (#2540)
Moving archive_entry_set_digest() to the public API simplifies porting
non-archive formats to archive formats while preserving supported
message digests specifically in cases where recomputing digests is not
viable.
2025-03-16 16:37:47 -07:00
Tobias Stoeckmann a88e09a370 Remove extra newline from error messages (#2541)
The lafe_errc function adds a newline by itself already, so do not
insert one into the message.

You can reproduce with the following commands:

```
touch archive.tar
bsdtar -xf archive.tar -C /non-existing
```

```
bsdtar --exclude ""
```

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-03-16 15:33:05 -07:00
ljdarj 09a2ed4853 FILE* seeking support (#2539)
Adding a seeker function to archive_read_open_FILE().

Fixes #437.
2025-03-15 11:17:27 -07:00
Martin Matuška 03e15babd6 CI: Update FreeBSD build environments (#2534)
FreeBSD 13.4 -> 13.5
FreeBSD 14.1 -> 14.2
2025-03-11 06:15:49 -07:00
Peter Kästle c9bc934e7e fix CVE-2025-1632 and CVE-2025-25724 (#2532)
Hi,

please find my approach to fix the CVE-2025-1632 and CVE-2025-25724
vulnerabilities in this pr.
As both error cases did trigger a NULL pointer deref (and triggered
hopefully everywhere a coredump), we can safely replace the actual
information by a predefined invalid string without breaking any
functionality.

---------

Signed-off-by: Peter Kaestle <peter@piie.net>
2025-03-10 08:43:04 -07:00
ljdarj 52e0bfd750 archive_version_details' update (#2349)
Adding missing librairies to `archive_version_details()`'s output. I put
"system" if the library doesn't give a way to query its version and
"bundled" if there's a choice between the system copy of a library and a
bundled one and we took the bundled copy (Only one library in that case,
libb2. Maybe also xxhash in the future?).

I would have a question for the Windows specialists though: is there a
way to query the interface version of a CNG cryptographic provider?
Because I know of a way for Crypto API providers but I haven't found any
for CNG ones, despite `<bcrypt.h>` having an interface version
structure.

Fixes #2300.
2025-03-07 19:28:51 -08:00
ljdarj de77e6d671 Moving the tests' CRC-32 function to test_utils. (#2390)
Following up from #2284, putting the tests' CRC-32 implementation in
test_utils and having all tests use it.
2025-03-07 19:21:23 -08:00
Tim Kientzle 3512329ba9 Avoid unreachable code in this test (#2528)
As remarked in #2521, this test has unreachable code on Windows, which
triggers a build failure in development due to warnings-as-errors.
(Release versions should not have warnings-as-errors.)
2025-03-01 09:06:31 -08:00
François Degros 21f74252f2 Handle ARCHIVE_FILTER_LZOP in archive_read_append_filter (#2519)
Fixes #2513
2025-02-24 07:01:39 -08:00
ljdarj b6f6557abb Fixing up archive_read_format's man page. (#2518)
Adding the requested updates to the man pages.

Fixes libarchive#2507.
2025-02-22 09:06:28 -08:00
ljdarj 65196fdd1a Remove dev_t and time_t from public API in 4.0 (#2392)
Removing dev_t and time_t from the public include files from 4.0 on and
updating some tests in consequence.

Fixes #2279 .
2025-01-25 10:14:42 -08:00
Graham Percival 42565b88b5 Cast (mode_t)mode for POSIX functions (#2476) 2025-01-06 16:44:40 -08:00
Mostyn Bramley-Moore 743bbe9769 Fix another GCC version detection error (#2474)
This is another instance of the same bug that was fixed in #2472.
2025-01-01 15:36:17 -08:00
Mostyn Bramley-Moore 7708713b63 Suppress macOS CC_MD5_* deprecation warnings in the autoconf build too (#2473)
This also limits the amount of code where deprecation warnings are
suppressed.

Previously these warnings were only suppressed in the cmake build.
2025-01-01 15:30:37 -08:00
Sam James a186d9662b Fix GCC version detection for __attribute__((deprecated)) (#2472)
The #if condition as-written fails for any major >= 3 if minor < 1, e.g.
GCC 15.0 (while in development).

Use the idiom described in the GCC docs [0] to avoid this.

[0] https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html

Fixes: ab94a813b0
2025-01-01 10:56:51 -08:00
Silent 14b8803c40 Fix a Y2038 bug by replacing Int32x32To64 with regular multiplication (#2471)
`Int32x32To64` macro internally truncates the arguments to int32, while
`time_t` is 64-bit on most/all modern platforms. Therefore, usage of
this macro creates a Year 2038 bug.

I detailed this issue a while ago in a writeup, and spotted the same
issue in this repository when updating the list of affected
repositories:
<https://cookieplmonster.github.io/2022/02/17/year-2038-problem/>

A few more notes:
1. I changed all uses of `Int32x32To64` en masse, even though at least
one of them was technically OK and used with int32 parameters only. IMO
better safe than sorry.
2. This is untested, but it's a small enough change that I hope the CI
success is a good enough indicator.
2025-01-01 08:31:35 -08:00
Graham Percival 25c3d9afea Fix compiler nitpicks (#2470) 2024-12-30 19:42:04 -08:00
Graham Percival 982747fd66 Fix compiler nitpicks (#2469) 2024-12-30 13:31:48 -08:00
Mostyn Bramley-Moore adc54b374e Fix MSVC conversion from DWORD to short warning (#2468) 2024-12-30 08:32:39 -08:00
Mostyn Bramley-Moore ef3f9c45d5 Fix MSVC zstd conversion from size_t to int warnings (#2467) 2024-12-30 08:32:01 -08:00
Mostyn Bramley-Moore 1427f3431d Detect endianness at build time for common MSVC targets also (#2466)
This should now cover the most common build targets.
2024-12-30 08:31:14 -08:00
Graham Percival edcae6c164 Fix compiler nitpicks (#2465) 2024-12-30 08:30:42 -08:00
Mostyn Bramley-Moore 561b6430fd Prefer build-time endianness detection (#2464)
Endianness is easy to determine at runtime, but detecting this a single
time and then reusing the cached result might require API changes.

However we can use compile-time detection for some known compiler macros
without API changes fairly easily. Let's start by enabling this for
Clang and GCC.
2024-12-29 18:10:23 -08:00
Graham Percival 4ce9c2f4be Add more casts for %c, %o, and %x (#2463) 2024-12-29 10:20:24 -08:00
Graham Percival dc5e1405b6 Spelling fixes for func, struct, and macros (#2462) 2024-12-29 10:19:21 -08:00
Graham Percival a2086b67d8 Add more casts for %o (#2461) 2024-12-29 10:18:06 -08:00
Graham Percival 14221c7ba2 Add straightforward casts for %o and %x (#2458) 2024-12-28 16:29:47 -08:00
Mostyn Bramley-Moore 28cb5064d8 7zip reader: add support for POWERPC filter for non-LZMA compressors (#2459)
This new test archive contains a C hello world executable built like so
on a ubuntu 24.04 machine:
```
#include <stdio.h>

int main(int argc, char *argv[]) {
  printf("hello, world\n");
  return 0;
}
```

`powerpc-linux-gnu-gcc hw.c -o hw-powerpc -Wall`

The test archive that contains this executable was created like so,
using 7-Zip 24.08:
`7zz a -t7z -m0=deflate -mf=ppc
libarchive/test/test_read_format_7zip_deflate_powerpc.7z hw-powerpc`

This test fails in the first commit in this PR, and passes in the second
commit.
2024-12-28 15:36:01 -08:00
Graham Percival a659a44a85 Fix format strings (#2457) 2024-12-28 11:03:17 -08:00
Graham Percival b557c1f161 Add tar/test/test_list_item (#2454) 2024-12-28 11:01:19 -08:00
Tim Kientzle 12517fa78d Fix the test for NOABSOLUTEPATHS (#2456)
The test inadvertently tried to manipulate the wrong archive at one
point.
2024-12-27 15:51:33 -08:00
Stephane ChazelasandStephane Chazelas 4d5106f2b5 tar: fix bug when -s/a/b/ used more than once with b flag (#2435)
When the -s/regexp/replacement/ option was used with the b flag more
than once, the result of the previous substitution was appended to the
previous subject instead of replacing it. Fixed it by making sure the
subject is made the empty string before the call to realloc_strcat().
That in effect makes it more like a realloc_strcpy(), but creating a new
realloc_strcpy() function for that one usage doesn't feel worth it.

Resolves Issue libarchive/libarchive#2414

Co-authored-by: Stephane Chazelas <stephane@chazelas.org>
2024-12-27 15:20:16 -08:00
Zeun 4ebca5ff83 Fix -Werror=warning error and wrap some INSTALL directives with an ENABLE_INSTALL guard (#2397)
1. Fixes build when compiling without ZLIB/BZIP/LZMA `char finishing`
2. All INSTALL directives are now guarded by ENABLE_INSTALL
2024-12-27 12:53:13 -08:00
Mostyn Bramley-Moore e6d8a479b1 ci: use at most the number of make threads as there are cores on mac and linux github runners (#2437)
We previously told make to run as many threads as it likes on these CI
jobs, but that might sometimes hit resource limits like RAM or the
allowed number of open files.

These numbers were found experimentally by using `sysctl -n hw.ncpu` on
mac and `nproc` on linux.
2024-12-27 12:40:47 -08:00
Graham Percival 0acaa2994a Fix remaining TODOs in test_stdio.c (#2444) 2024-12-27 12:38:03 -08:00
Graham Percival 35da265cc3 Remove unnecessary semicolons (#2450) 2024-12-25 09:35:54 -08:00
Graham Percival 0d1ac07d3f Remove unreachable 'break' statements (#2451) 2024-12-25 09:33:11 -08:00
Graham Percival a17bded84a Fix %d -> %u for unsigned int from i4le() (#2448)
`i4le()` returns an unsigned int, so `'%d'` is incorrect.

Reported by `clang -Wformat`. (Many more such fixes to come, but this is
the simplest set of them.)
2024-12-24 15:27:26 -08:00
Graham Percival e99c6d69f1 Fix CRLF line endings in source files (#2449) 2024-12-24 15:25:53 -08:00
Graham Percival af4a3562cd Reject relative path for test refdir (#2445) 2024-12-24 11:51:50 -08:00
Graham Percival 1f6cdd4625 Fix a few clang nitpicks (#2447)
Fixes warnings found by:
```
-Wformat-non-iso
-Wnewline-eof
-Wmissing-variable-declarations
```
2024-12-24 11:50:19 -08:00
Graham Percival 72bbf9ec25 Fix some TODOs in tar/test/test_stdio.c (#2442) 2024-12-19 14:24:57 -08:00
Mostyn Bramley-Moore 819a50a043 Remove liblzmadec remnants (#2436)
It looks like support for this library was removed in 2016, but we still
had some unused cmake code and a dead preprocessor block.
2024-12-15 23:14:57 +01:00
Mostyn Bramley-Moore ee9b638fba 7zip reader: add LZMA + RISCV BCJ filter (#2403)
7-Zip 24.05 and liblzma 5.5.1alpha added a RISC-V BCJ filter. Let's
enable this combination if we can.

Note that this does not allow the use of the RISC-V filter with other
compressors.
2024-12-15 23:12:02 +01:00
Mostyn Bramley-Moore b0d48940f8 7zip writer: support multithreaded zstandard compression (#2391)
Command example:
bsdtar -cavf /tmp/foo.7z --options='compression=zstd,threads=4' *
2024-12-15 23:10:17 +01:00
Mostyn Bramley-Moore 6516cd137e Remove unnecessary HAVE_LZMA_FILTER_ARM64 feature check (#2433)
It is sufficent to use HAVE_LZMA_H and then check for macros defined in
lzma.h
2024-12-10 20:35:16 -08:00
Tim Kientzle 8291210321 Handle truncation in the middle of a GNU long linkname (#2422)
Thanks to gbdngb12 김동건 for reporting this.

Resolves Issue #2415
2024-12-09 21:09:29 -08:00
Mostyn Bramley-Moore 7efa99bdb1 ci: make skipped tests more obvious (#2430)
Previously skipped tests were reported like this when running the *_test
binaries:
```
 4: test_acl_platform_nfs4                                          ok (S)
```

Let's make this more obvious:
```
  4: test_acl_platform_nfs4                                         skipped
```
2024-12-08 18:08:34 -08:00
Mostyn Bramley-Moore 8ac45a813e Report skipped tests to cmake/ctest (#2429)
This plumbing is required for cmake/ctest to recognise and report
skipped tests.

Now skipped tests in cmake ci jobs are reported like so:
```
          Start   7: libarchive_test_acl_platform_posix1e_read
    7/785 Test   #7: libarchive_test_acl_platform_posix1e_read ................................***Skipped   0.02 sec
```

And there is a list of skipped tests shown at the end of the test run.
2024-12-08 18:07:49 -08:00
Mostyn Bramley-Moore ba76798136 ci: speed up windows/mingw build by using multiple make jobs (#2428)
This decreases the "Install library dependencies" step duration from
~4min to ~2min, and the "Build" step duration from ~10min to ~4min.
2024-12-07 16:39:46 -08:00
Mostyn Bramley-Moore 29802f6a5e ci: make autoconf look for headers and libraries in /opt/homebrew if those directories exist (#2427)
Prior to this change, the ci autoconf jobs weren't looking for homebrew
headers or libraries unless pkg-config was used, so for example the
"MacOS (autotools)" ci job wasn't testing lz4 or zstd code.

Relates to #2426.
2024-12-07 15:11:19 -08:00
Mostyn Bramley-Moore 0bbbe2883e ci: log bsdtar's version text, so we can see which support libraries were used (#2426)
A few of libarchive's CI jobs don't find all the local support libraries
that they could be using. This change makes it easier to see which of
them are used.
2024-12-07 15:10:42 -08:00
Mostyn Bramley-Moore 9b7540aaf1 ci: find liblzma >= 5.6.3 on windows msvc tests (#2421)
We currently use XZ Utils 5.6.3 on windows CI jobs, but the Windows
(msvc)
job which uses cmake seems to only be looking for the old library name,
liblzma.lib:

```
-- Looking for lzma_auto_decoder in C:/Program Files (x86)/xz/lib/liblzma.lib
-- Looking for lzma_auto_decoder in C:/Program Files (x86)/xz/lib/liblzma.lib - not found
-- Looking for lzma_easy_encoder in C:/Program Files (x86)/xz/lib/liblzma.lib
-- Looking for lzma_easy_encoder in C:/Program Files (x86)/xz/lib/liblzma.lib - not found
-- Looking for lzma_lzma_preset in C:/Program Files (x86)/xz/lib/liblzma.lib
-- Looking for lzma_lzma_preset in C:/Program Files (x86)/xz/lib/liblzma.lib - not found
-- Could NOT find LibLZMA (missing: LIBLZMA_HAS_AUTO_DECODER LIBLZMA_HAS_EASY_ENCODER LIBLZMA_HAS_LZMA_PRESET) (found version "5.6.3")
```

We need to update build/ci/github_actions/ci.cmd to look for lzma.lib
instead.
2024-12-06 19:56:06 -08:00
Graham Percival f745a848d7 Spelling fixes (#2412) 2024-12-06 08:00:03 -08:00
Julian Uy 819c5b01a9 Check for tcgetattr / tcsetattr before using it for readpassphrase implementation (#2424)
This is mainly for non-cygwin newlib platforms that don't have tcgetattr
/ tcsetattr implemented
2024-12-06 07:58:58 -08:00
Julian Uy b5d95321d4 Add missing definition for getline polyfill (#2425)
The fallback for when `getline` is not implemented in libc was not
compiling due to the fact that the definition for it was missing, so add
the definition.
2024-12-06 07:57:27 -08:00
Alexander Ziaee 68238f28ee bsdtar.1: Mention rar support + manual page polish (#2423)
I have been using this for years without realizing it decompresses rar.

+ add rar to supported decompression formats
+ use section references to link sections (this makes them clickable in
GUIs)
+ add paragraph breaks for consistent spacing
+ pdtar is not this program, so use Sy per mdoc style guide
+ do almost the same in reverse for bsdtar
+ remove parenthetical around a complete sentance

Thank you so much, this is wonderful software.
2024-12-06 07:50:06 -08:00
Mostyn Bramley-Moore 84ad874530 Test with XZ Utils 5.6.3 on windows CI jobs (#2417)
This change fixes the autotools build to work with xz-utils 5.6.3, which
changed library names on windows, and fixes a couple of tests that I
noticed had dependencies on liblzma.
2024-12-02 00:29:46 +01:00
MithicSpirit cbfe4d9e6d nit(tar): fix typo (#2420) 2024-11-30 22:21:45 -05:00
ljdarj e37d378186 Moving the tests' integer reading functions to test_utils. (#2410)
Moving the tests' integer reading functions to test_utils so that they
all use the same as well as moving the few using the archive_endian
functions over to the test_utils helper.

Follow-up from libarchive#2390.
2024-11-16 17:42:27 -08:00
Tim Kientzle d60f3ea1b3 Ignore ustar size when pax size is present (#2405)
When the pax `size` field is present, we should ignore the size value in
the ustar header. In particular, this fixes reading pax archives created
by GNU tar with entries larger than 8GB.

Note: This doesn't impact reading pax archives created by libarchive
because libarchive uses tar extensions to store an accurate large size
field in the ustar header. GNU tar instead strictly follows ustar in
this case, which prevents it from storing accurate sizes in the ustar
header.

Resolves #2404
2024-11-06 22:21:54 +01:00
Mostyn Bramley-Moore 974b59113d 7zip reader: add SPARC filter support for non-LZMA compressors (#2399)
These two new test archives contain a C hello world executable built
like so on a ubuntu 24.04 machine:

```
#include <stdio.h>

int main(int argc, char *argv[]) {
  printf("hello, world\n");
  return 0;
}
```

`sparc64-linux-gnu-gcc hw.c -o hw-sparc64 -Wall`

The two test archives that contain this executable were created like so,
using the https://github.com/tehmul/p7zip-zstd fork of 7-Zip:
`7z a -t7z -m0=zstd -mf=SPARC
libarchive/test/test_read_format_7zip_zstd_sparc.7z hw-sparc64`
`7z a -t7z -m0=lzma2 -mf=SPARC
libarchive/test/test_read_format_7zip_lzma2_sparc.7z hw-sparc64`

Two test files are required, because the 7zip reader code has two
different paths, one for lzma and one for all other compressors.

The test_read_format_7zip_lzma2_sparc test is expected to pass, because
LZMA BCJ filters are implemented in liblzma.

The test_read_format_7zip_zstd_sparc test is expected to fail in the
first commit, because libarchive does not currently implement the SPARC
BCJ filter. The second commit will make test_read_format_7zip_zstd_sparc
pass.
2024-10-28 19:29:23 -07:00
Tim Kientzle e36d6fe935 Revert "Use proper Create OS value on Windows to fix archive charset detection (#2240) (#2401)
Two problems are prompting this revert:

* In order to change the Create OS value to "Windows", we would need to
record other data (such as `external_attributes`) in Windows format as
well.

* Changing the Create OS value doesn't actually fix the
filename-encoding issue that originally motivated this PR

This reverts commit 755af84301.
2024-10-27 19:34:51 -07:00
Mostyn Bramley-Moore 87fa733679 Rename bsdtar test_extract_tar_absolute_paths source file for consistency (#2400)
The `-P` flag is uppercase, so the test file should be named
test_option_P_upper.c for consistency with the other test files in this
directory.

Sorry about the noise.
2024-10-27 08:43:59 -07:00
Martin Matuška 2cea675da2 tests: redirect stdout in one call in test_extract_tar_absolute_paths (#2386)
This redirects the message "Removing leading '/' from member names"
from stderr to a file in one case.
2024-10-25 18:45:28 +01:00
Martin Matuska 043b6feeef Fix tests added in #2284 (#2387) 2024-10-23 18:47:32 +02:00
Martin Matuska 206df6192c Revert "add --mac-metadata test for --format zip - see #2041 (#2045)"
This reverts commit ea56096020.
2024-10-23 18:45:23 +02:00
nielash ea56096020 add --mac-metadata test for --format zip - see #2041 (#2045)
Submitting this test at the request of @kientzle on issue #2041.

Note that failure is currently expected, as the feature it tests is not
yet implemented!
2024-10-22 11:16:55 +02:00
Dustin L. Howett e619342dfa write_xar: move libxml2 behind an abstraction layer (#1849)
This commit prepares the XAR writer for another XML writing backend.

Almost everything in this changeset leaves the code identical to how
it started, except for a new layer of indirection between the xar writer
and the XML writer.

The things that are not one-to-one renames include:
- The removal of `UTF8Toisolat1` for the purposes of validating UTF-8
- The writer code made a copy of every filename for the purposes of
  checking whether it was Latin-1 stored as UTF-8. In xar, Non-Latin-1
  gets stored Base64-encoded.
- I've replaced this use because (1) it was inefficient and (2)
  `UTF8Toisolat1` is a `libxml2` export.
- The new function has slightly different results than the one it is
  replacing for invalid UTF-8. Namely, it treats illegal UTF-8 "overlong"
  encodings of Latin-1 codepoints as _invalid_. It operates on the principle
  that we can determine whether something is Latin-1 based entirely on how
  long the sequence is expected to be.
- The move of `SetIndent` to before `StartDocument`, which the
  abstraction layer immediately undoes. This is to accommodate XML writers 
  that require indent to be set _before_ the document starts.
2024-10-22 11:10:50 +02:00
Mostyn Bramley-Moore ae23713ceb 7zip writer: initial support for zstandard compression (#2137)
This is intended to be compatible with:
* https://github.com/mcmilk/7-Zip-zstd
* https://github.com/tehmul/p7zip-zstd
2024-10-22 11:01:55 +02:00
ljdarj 15c686c55f Adding XZ, LZMA, ZSTD and BZIP2 support to ZIP writer (#2284)
PPMD may come later but I'd rather first iron out style issues with the
ones needing only to wire up libraries already-used in Libarchive before
going at the ones possibly requiring implementing algorithms as well.

Closes #1046 and resolves #1179.
2024-10-22 10:58:22 +02:00
unxed 755af84301 Use proper Create OS value on Windows to fix archive charset detection (#2240)
See https://sourceforge.net/p/sevenzip/bugs/2463
2024-10-22 10:56:19 +02:00
Dustin L. Howett ac43e8e3fe Reintroduce size_t cast to clarify the use of a u32 shift on a u64 arg (#2383)
Regressed in #2285
2024-10-22 10:52:19 +02:00
vcoxvcoandvco 40ff837717 Various small fixes for Cygwin, Haiku, OpenIndiana (#2346)
Cygwin 3.5.4 (same applies for 3.5.3),
I get a compile error as shown below after a simple ./configure and
make. Adding <windef.h> solves the problem.

Co-authored-by: vco <god@universe.sys>
2024-10-14 08:44:17 -07:00
Martin Matuška d8c3b97b31 tests: use const char instead of char in one case (#2381)
Found in test_extract_cpio_absolute_paths.c when compiling FreeBSD base
2024-10-13 13:41:06 -07:00
Tim Kientzle 971c043a1d Ignore checksum mismatches when fuzzing tar archives (#2378)
This should speed up fuzzing just a bit, so we
can find more bugs!
2024-10-13 09:42:38 +02:00
dependabot[bot] 295f47a074 CI: Bump the all-actions group across 1 directory with 4 updates (#2379)
Bumps the all-actions group with 4 updates:

actions/checkout from 4.1.6 to 4.2.1
actions/upload-artifact from 4.3.3 to 4.4.3
github/codeql-action from 3.25.6 to 3.26.12
ossf/scorecard-action from 2.3.3 to 2.4.0

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-13 09:42:01 +02:00
Tim Kientzle aada018f05 Increase the hole size for this test to 32MiB (#2380)
APFS on macOS 15 seems to have a higher threshold for creating sparse
files.
2024-10-13 09:35:17 +02:00
Emil Velikov 6287b99eb7 Convert the tools and respective tests to SPDX (#2317)
This is the first part of converting the project to use SPDX license
identifiers instead using the verbose license text.

The patches are semi-automated and I've went through manually to ensure
no license changes were made. That said, I would welcome another pair of
eyes, since I am only human.

See https://github.com/libarchive/libarchive/issues/2298

---------

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-12 20:54:16 -07:00
Christian Schmitz b8d7e074c1 Update archive_private to avoid template keyword (#2342)
People really should never, ever, ever use libarchive internal headers.  And they definitely should not expect libarchive internal headers to work in a C++ compiler.  (C++ and C are really just not that compatible.)

However, people do a lot of things they shouldn't:  Avoid the reserved C++ keyword `template`
2024-10-12 17:47:30 -07:00
vcoxvcoandvco e2c512a59f configure.ac,CMakeLists.txt: Add libbsd on Haiku for readpassphrase (#2352)
Followup from #2346 

Add libbsd to make/cmake configuration for linking readpassphrase on
Haiku.
Maybe there is a better way to do this for cmake, I'm not that familiar
with it.

Co-authored-by: vco <god@universe.sys>
2024-10-12 17:44:32 -07:00
Martin Matuška c0ce80b970 CI: Update build environments (#2373)
FreeBSD 13.3 -> 13.4
FreeBSD 14.0 -> 14.1
Ubuntu 22.04 -> 24.04
2024-10-12 09:31:20 -07:00
Tim Kientzle 3343bb8a28 Fix two leaks in tar header parsing (#2377)
OSS-Fuzz found two places where an error return would bypass cleaning up
a local allocation.

Credit: OSS-Fuzz
2024-10-12 13:54:23 +02:00
Martin Matuška 10c817cdc3 tests: change file format from dos to unix in one test file (#2376) 2024-10-11 20:54:59 -07:00
Duncan Horn 2121da4bbb [7zip] Read/write symlink paths as UTF-8 (#2252)
I previously tried to find documentation on how symlinks are expected to
be stored in 7zip files, however the best reference I could find was
[here](https://py7zr.readthedocs.io/en/latest/archive_format.html). That
site suggests that symlink paths are stored as UTF-8 encoded strings:
2024-10-11 08:30:25 +02:00
Duncan Horn 6177e4d0c0 Update RAR5 code to report encryption (#2096)
Currently, the RAR5 code always reports
`ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED` for
`archive_read_has_encrypted_entries`, nor does it set any of the
entry-specific properties, even though it has enough information to
properly report this information. Accurate reporting of encryption is
super useful for applications because reporting an error message such as
"the archive is encrypted, but we don't currently support encryption" is
a lot better than a not generally useful `errno` value and a
non-localizable error string with a confusing and unpredictable error
message.

Fixes #1661
2024-10-11 08:25:47 +02:00
ljdarj e4068fb87c Change to Windows absolute symlinks. (#2362)
Change to read absolute symlinks as verbatim paths instead of NT paths:
as far as I can see, libarchive can deal with verbatim paths while it
can't with NT ones.

Fixes #2274.
2024-10-11 08:18:55 +02:00
Michał Górny 94da78b084 configure.ac: remove incorrect 4th argument to AC_CHECK_FUNCS (#2334)
Remove the incorrect 4th argument from `AC_CHECK_FUNCS` calls. The macro
uses only three arguments, so it was ignored anyway. Furthermore, in at
least once instance it was wrong -- due to a typo in `attr/xatr.h`
header name.
2024-10-11 08:17:01 +02:00
Tim Kientzle 565b5aea49 Don't crash on truncated tar archives (#2364)
The tar header parsing overhaul in #2127 introduced a systematic
mishandling of truncated files: the code incorrectly checks for whether
a given read operation failed, and ends up dereferencing a NULL pointer
in this case. I've gone back and double-checked how
`__archive_read_ahead` actually works (it returns NULL precisely when it
was unable to satisfy the read request) and reworked the error handling
for each call to this function in archive_read_support_format_tar.c

Resolves #2353
Resolves https://issues.oss-fuzz.com/issues/42537231
2024-10-11 08:16:12 +02:00
Tim Kientzle b34c1f4def Sanity-check gzip header field length (#2366)
OSS-Fuzz managed to construct a small gzip input that decompresses into
another gzip input with an extremely large filename field. This causes
libarchive to hang processing the inner gzip.

Address this by rejecting any gzip input where the filename or comment
fields exceed 1MiB.

Credit: OSS-Fuzz
2024-10-11 08:14:58 +02:00
Tim Kientzle 35e630174e Clarify crc32 variable names (#2367)
No functional change, just a tiny style improvement.

Use `crc32_computed` to refer to the crc32 that the reader has computed
and `crc32_read` to refer to the value that we read from the archive.
That hopefully makes this code a tiny bit easier to follow. (It confused
me recently when I was double-checking something in this area, so I
thought an improvement here might help others.)
2024-10-11 08:13:00 +02:00
Tim Kientzle 41a2d01453 Fix error message printing (#2368)
We always print the error message with or without -v, but for some
reason, we were omitting the path being processed. Simplify so that we
always print the full error including context.
2024-10-11 08:11:43 +02:00
Steve Lhomme 08ab094ea7 Don't use Windows bcrypt when building for Windows XP or older (#2374)
The header may be detected but we can't use the calls.

The same check is already done in many places but not all of them.
2024-10-08 21:06:57 -07:00
Mostyn Bramley-Moore a65f765f17 bsdcpio should exit with an error code if an entry can't be extracted (#2371)
For example if --insecure is not specified, and one of the security
checks fails.
2024-10-07 08:51:17 -07:00
Mostyn Bramley-Moore d6dd082adf Add absolute path test for bsdtar (#2370)
Check that extracting archive entries with absolute paths uses mangled
relative paths unless -P / --absolute-paths is specified.
2024-10-06 20:35:28 -07:00
Mostyn Bramley-Moore 62ce582d1c Simplify tests added in #2363, use testworkdir (#2369) 2024-10-06 20:34:58 -07:00
Martin Matuška 9d5289ae9e Fix pathname overwrite in header_old_tar() (#2360)
Fixes #2359
2024-10-06 20:31:38 -07:00
Dag-Erling Smørgrav a90e9d84ec Miscellaneous code cleanup (#2285)
This fixes various code quality issues I encountered while chasing a
memory leak reported by test automation. I failed to reproduce the
memory leak, but I hope you find this useful nonetheless.
2024-10-04 08:45:58 -07:00
Mostyn Bramley-Moore 2fd35b0fdb Fix ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS on windows (#2363) 2024-10-04 08:36:56 -07:00
Mostyn Bramley-Moore 6567375f27 Reenable CI tests for MSVC (#2356)
These were disabled when migrating from Cirrus CI. Let's enable them for
github workflows, disable any failing tests on this configuration and
leave TODO notes to fix them.

This was the only failure that I found:
```
  684/764 Test #684: bsdtar_test_option_ignore_zeros_mode_c ...................................***Failed    0.10 sec
  
  If tests fail or crash, details will be in:
     C:\Users\RUNNER~1\AppData\Local\Temp/bsdtar_test.exe.2024-09-29T11.42.13-000
  
  Reference files will be read from: D:/a/libarchive/libarchive/tar/test
  Running tests on: "D:\a\libarchive\libarchive\build_ci\cmake\bin\Release\bsdtar.exe"
  Exercising: bsdtar 3.8.0 - libarchive 3.8.0dev zlib/1.3 liblzma/5.4.4 bz2lib/1.1.0 libzstd/1.5.5 
  
   39: test_option_ignore_zeros_mode_c
  D:\a\libarchive\libarchive\tar\test\test_option_ignore_zeros.c(99): File should be empty: test-c.err
      File size: 112
      Contents:
  0000 62 73 64 74 61 72 2e 65 78 65 3a 20 61 3a 20 43 bsdtar.exe: a: C
  0010 61 6e 27 74 20 74 72 61 6e 73 6c 61 74 65 20 75 an't translate u
  0020 6e 61 6d 65 20 27 28 6e 75 6c 6c 29 27 20 74 6f name '(null)' to
  0030 20 55 54 46 2d 38 0d 0a 62 73 64 74 61 72 2e 65  UTF-8..bsdtar.e
  0040 78 65 3a 20 62 3a 20 43 61 6e 27 74 20 74 72 61 xe: b: Can't tra
  0050 6e 73 6c 61 74 65 20 75 6e 61 6d 65 20 27 28 6e nslate uname '(n
  0060 75 6c 6c 29 27 20 74 6f 20 55 54 46 2d 38 0d 0a ull)' to UTF-8..
  
  Totals:
    Tests run:                1
    Tests failed:             1
    Assertions checked:      21
    Assertions failed:        1
    Skips reported:           0
```
2024-09-29 21:36:48 -07:00
Tim Kientzle 4b6dd229c6 Remove two unnecessary strings from the tar state (#2345)
`pax_global` is not used at all and can be removed.

`longname` is only used locally within one function, so convert it to a
local variable there.
2024-09-24 19:12:11 -07:00
Tim Kientzle 75cdc59470 Clean up linkpath between entries (#2343)
PR #2127 failed to clean up the linkpath storage between entries. As a
result, after the first hard/symlink entry in a pax format archive, all
subsequent entries would get the same link information.

I'm really unsure how this bug failed to trip CI. I'll do some digging
in the test suite before I merge this.

Resolves #2331 , #2337

P.S. Thanks to Brad King for noting that the linkpath wasn't being
managed correctly, which was a big hint for me.
2024-09-23 01:06:34 +02:00
Michał Górny fa7e9cd7cb tar/write.h: Support sys/xattr.h (#2335)
Synchronize the last use of `attr/xattr.h` to support using
`sys/xattr.h` instead. The former header is deprecated on GNU/Linux, and
this replacement makes it possible to build libarchive without the
`attr` package.
2024-09-20 19:44:06 -07:00
Brad King 7c3980367e tar: fix memory leaks when processing symlinks or parsing pax headers (#2338)
Fix memory leaks introduced by #2127:

* `struct tar` member `entry_linkpath` was moved at the same time as
   other members were removed, but its cleanup was accidentally removed
   with the others.

* `header_pax_extension` local variable `attr_name` was not cleaned up.

Resolves #2336
2024-09-20 14:11:43 +02:00
Tim Kientzle e939c97a57 Be more cautious about parsing ISO-9660 timestamps (#2330)
Some ISO images don't have valid timestamps for the root directory
entry. Parsing such timestamps can generate nonsensical results, which
in one case showed up as an unexpected overflow on a 32-bit system.

Add some validation logic that can check whether a 7-byte or 17-byte
timestamp is reasonable-looking, and use this to ignore invalid
timestamps in various locations. This also requires us to be a little
more careful about tracking which timestamps are actually known.

Resolves issue #2329
2024-09-19 22:20:02 -07:00
Martin Matuska 915c9f83a4 Libarchive 3.8.0dev 2024-09-13 23:13:01 +02:00
868 changed files with 101480 additions and 16909 deletions

No files matched your search

-44
View File
@@ -1,44 +0,0 @@
env:
CIRRUS_CLONE_DEPTH: 1
ARCH: amd64
FreeBSD_task:
matrix:
env:
BS: autotools
env:
BS: cmake
matrix:
freebsd_instance:
image_family: freebsd-14-0
freebsd_instance:
image_family: freebsd-13-3
prepare_script:
- ./build/ci/cirrus_ci/ci.sh prepare
configure_script:
- env CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./build/ci/build.sh -a autogen
- env CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./build/ci/build.sh -a configure
build_script:
- env MAKE_ARGS="-j 2" ./build/ci/build.sh -a build
test_script:
- env SKIP_TEST_RESTORE_ATIME=1 MAKE_ARGS="-j 2" ./build/ci/build.sh -a test
- ./build/ci/cirrus_ci/ci.sh test
install_script:
- env MAKE_ARGS="-j 2" ./build/ci/build.sh -a install
Windows_Cygwin_task:
windows_container:
image: cirrusci/windowsservercore:2019
os_version: 2019
env:
BE: cygwin-gcc
prepare_script:
- build\ci\cirrus_ci\ci.cmd prepare
configure_script:
- build\ci\cirrus_ci\ci.cmd configure
build_script:
- build\ci\cirrus_ci\ci.cmd build
test_script:
- build\ci\cirrus_ci\ci.cmd test
install_script:
- build\ci\cirrus_ci\ci.cmd install
+69 -28
View File
@@ -6,15 +6,36 @@ permissions:
contents: read
jobs:
MacOS:
runs-on: macos-13
FreeBSD:
runs-on: ubuntu-latest
strategy:
matrix:
bs: [autotools, cmake]
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Build and test on a FreeBSD 15 firecracker VM
uses: acj/freebsd-firecracker-action@e04896d2dd91f7ec7381e5f363c6fbe83ee445c3 # v0.11.0
with:
run-in-vm: |
chflags -R noschg / && \
fetch -o - https://download.freebsd.org/releases/amd64/15.0-RELEASE/base.txz | bsdtar -x -C / -f - && \
pkg bootstrap -y && \
cd firecracker-freebsd && \
env BS=${{ matrix.bs }} ./build/ci/github_actions/freebsd.sh prepare && \
env BS=${{ matrix.bs }} CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./build/ci/build.sh -a autogen && \
env BS=${{ matrix.bs }} MAKE=gmake CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./build/ci/build.sh -a configure && \
env BS=${{ matrix.bs }} MAKE=gmake MAKE_ARGS="-j 2" ./build/ci/build.sh -a build && \
env BS=${{ matrix.bs }} MAKE=gmake SKIP_TEST_RESTORE_ATIME=1 MAKE_ARGS="-j 2" ./build/ci/build.sh -a test && \
env BS=${{ matrix.bs }} ./build/ci/github_actions/freebsd.sh test && \
env BS=${{ matrix.bs }} MAKE=gmake MAKE_ARGS="-j 2" ./build/ci/build.sh -a install
MacOS:
runs-on: macos-15
strategy:
matrix:
bs: [autotools, cmake]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install dependencies
run: ./build/ci/github_actions/macos.sh prepare
run: ./build/ci/github_actions/install-macos-dependencies.sh
- name: Autogen
run: ./build/ci/build.sh -a autogen
env:
@@ -23,41 +44,43 @@ jobs:
run: ./build/ci/build.sh -a configure
env:
BS: ${{ matrix.bs }}
# Avoid using liblzma from the Xcode 16 / MacOSX15.0.sdk, which fails RISCV filter tests.
CMAKE_ARGS: -D LIBLZMA_LIBRARY=/opt/homebrew/lib/liblzma.dylib -D LIBLZMA_INCLUDE_DIR=/opt/homebrew/include/lzma.h
- name: Build
run: ./build/ci/build.sh -a build
env:
BS: ${{ matrix.bs }}
MAKE_ARGS: -j
MAKE_ARGS: -j3
- name: Test
run: ./build/ci/build.sh -a test
env:
BS: ${{ matrix.bs }}
SKIP_OPEN_FD_ERR_TEST: 1
IGNORE_TRAVERSALS_TEST4: 1
MAKE_ARGS: -j
MAKE_ARGS: -j3
CTEST_OUTPUT_ON_FAILURE: ON
- name: Install
run: ./build/ci/build.sh -a install
env:
BS: ${{ matrix.bs }}
MAKE_ARGS: -j
MAKE_ARGS: -j3
- name: Artifact
run: ./build/ci/build.sh -a artifact
env:
BS: ${{ matrix.bs }}
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: libarchive-macos-${{ matrix.bs }}-${{ github.sha }}
path: libarchive.tar.xz
Ubuntu:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
bs: [autotools, cmake]
crypto: [mbedtls, nettle, openssl]
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Update apt cache
run: sudo apt-get update
- name: Install dependencies
@@ -75,13 +98,13 @@ jobs:
run: ./build/ci/build.sh -a build
env:
BS: ${{ matrix.bs }}
MAKE_ARGS: -j
MAKE_ARGS: -j4
- name: Test
run: ./build/ci/build.sh -a test
env:
BS: ${{ matrix.bs }}
SKIP_OPEN_FD_ERR_TEST: 1
MAKE_ARGS: -j
MAKE_ARGS: -j4
CTEST_OUTPUT_ON_FAILURE: ON
- name: Install
run: ./build/ci/build.sh -a install
@@ -91,14 +114,14 @@ jobs:
run: ./build/ci/build.sh -a artifact
env:
BS: ${{ matrix.bs }}
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: libarchive-ubuntu-${{ matrix.bs }}-${{ matrix.crypto }}-${{ github.sha }}
path: libarchive.tar.xz
Ubuntu-distcheck:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Update package definitions
run: sudo apt-get update
- name: Install dependencies
@@ -113,7 +136,7 @@ jobs:
SKIP_OPEN_FD_ERR_TEST: 1
- name: Dist-Artifact
run: ./build/ci/build.sh -a dist-artifact
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: libarchive-${{ github.sha }}
path: libarchive-dist.tar
@@ -123,18 +146,36 @@ jobs:
strategy:
fail-fast: false
matrix:
be: [mingw-gcc, msvc]
be: [mingw-gcc, cygwin-gcc, msvc]
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Install mingw
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Cygwin
uses: cygwin/cygwin-install-action@3f0a3f9f988f7e96b8c18098ae05eaec175f5b52 # v6
if: ${{ matrix.be=='cygwin-gcc' }}
with:
install-dir: "D:\\cygwin"
packages: |-
make autoconf automake cmake
gcc-core binutils libtool pkg-config
bison zlib-devel libbz2-devel liblzma-devel
liblz4-devel libiconv-devel libxml2-devel
libzstd-devel libssl-devel
- name: Install MinGW (msys2)
uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2.32.0
if: ${{ matrix.be=='mingw-gcc' }}
run: choco install mingw
shell: cmd
- name: Install library dependencies
run: ./build/ci/github_actions/ci.cmd deplibs
shell: cmd
env:
BE: ${{ matrix.be }}
with:
location: "D:\\"
install: |-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-autotools
mingw-w64-x86_64-binutils
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-cmake
mingw-w64-x86_64-make
mingw-w64-x86_64-zlib
mingw-w64-x86_64-bzip2
mingw-w64-x86_64-xz
mingw-w64-x86_64-zstd
- name: Configure
run: ./build/ci/github_actions/ci.cmd configure
shell: cmd
@@ -161,7 +202,7 @@ jobs:
shell: cmd
env:
BE: ${{ matrix.be }}
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: libarchive-windows-${{ matrix.be }}-${{ github.sha }}
path: libarchive.zip
path: ${{ matrix.be=='cygwin-gcc' && 'libarchive.tar.xz' || 'libarchive.zip' }}
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
fuzz-seconds: 600
dry-run: false
- name: Upload Crash
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
+4 -4
View File
@@ -26,18 +26,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Initialize CodeQL
uses: github/codeql-action/init@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
uses: github/codeql-action/init@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
with:
languages: ${{ matrix.language }}
queries: +security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
uses: github/codeql-action/autobuild@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
uses: github/codeql-action/analyze@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
with:
category: "/language:${{ matrix.language }}"
+34
View File
@@ -0,0 +1,34 @@
name: Lint
on: [push, pull_request]
permissions:
contents: read
jobs:
Lint:
runs-on: ubuntu-26.04
env:
BS: cmake
CRYPTO: openssl
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Update apt cache
run: sudo apt-get update
- name: Install dependencies
run: sudo apt-get install -y autoconf automake build-essential cmake git libssl-dev nettle-dev libmbedtls-dev libacl1-dev libbz2-dev liblzma-dev liblz4-dev libzstd-dev lzop pkg-config zlib1g-dev libclang-22-dev libclang-cpp22-dev clang-22 ninja-build
- name: Install Lint
run: |-
set -euo pipefail
cmake -S build/la-lint -B /tmp/lint-build -GNinja
cmake --build /tmp/lint-build
cmake --install /tmp/lint-build
- name: Configure
run: ./build/ci/build.sh -a configure
env:
CMAKE_ARGS: -GNinja -DENABLE_CLANG_TIDY=YES -DCLANG_TIDY_PATH=la-lint
- name: Build
run: ./build/ci/build.sh -a build
env:
MAKE: ninja
MAKE_ARGS: --
+4 -4
View File
@@ -29,12 +29,12 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
uses: ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc # v2.4.4
with:
results_file: results.sarif
results_format: sarif
@@ -52,7 +52,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: SARIF file
path: results.sarif
@@ -60,6 +60,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
uses: github/codeql-action/upload-sarif@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
with:
sarif_file: results.sarif
+10 -3
View File
@@ -9,6 +9,7 @@
*.lo
*.recipe
*.sln
*.slnx
*.tlog
*.cmake
*.vcxproj
@@ -27,6 +28,8 @@ bsdcat
bsdcpio
bsdtar
bsdunzip
build/.ninja_deps
build/.ninja_log
build/autoconf/compile
build/autoconf/config.guess
build/autoconf/config.sub
@@ -39,8 +42,10 @@ build/autoconf/ltsugar.m4
build/autoconf/ltversion.m4
build/autoconf/lt~obsolete.m4
build/autoconf/missing
build/build.ninja
build/build/pkgconfig/libarchive.pc
build/cat/test/list.h
build/compile_commands.json
build/cpio/test/list.h
build/libarchive/test/list.h
build/pkgconfig/libarchive.pc
@@ -59,6 +64,8 @@ libtool
stamp-h1
tar/test/list.h
unzip/test/list.h
CLAUDE.md
GEMINI.md
CMakeCache.txt
CMakeFiles/
DartConfiguration.tcl
@@ -80,9 +87,9 @@ libarchive-*.tar.gz
libarchive-*.zip
Testing/
libarchive/libarchive.a
libarchive/libarchive.so
libarchive/libarchive.so.*
**/libarchive/libarchive.a
**/libarchive/libarchive.so
**/libarchive/libarchive.so.*
.DS_Store
+211 -175
View File
@@ -1,21 +1,11 @@
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
if(APPLE AND CMAKE_VERSION VERSION_LESS "3.17.0")
message(WARNING "CMake>=3.17.0 required to make the generated shared library have the same Mach-O headers as autotools")
endif()
cmake_minimum_required(VERSION 3.17 FATAL_ERROR)
if(POLICY CMP0065)
cmake_policy(SET CMP0065 NEW) #3.4 don't use `-rdynamic` with executables
endif()
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) #3.12.0 `find_package()`` uses ``<PackageName>_ROOT`` variables.
endif()
if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW) #3.12.0 `check_include_file()`` and friends use ``CMAKE_REQUIRED_LIBRARIES``.
endif()
#
PROJECT(libarchive C)
#
# Include standard installation directories
include(GNUInstallDirs)
#
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake")
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin)
@@ -107,6 +97,9 @@ set(MACHO_CURRENT_VERSION "${MACHO_COMPATIBILITY_VERSION}.${_revision}")
# saving and restoring the state of the variables.
INCLUDE(CMakePushCheckState)
# Enable the pkg-config helpers.
INCLUDE(FindPkgConfig)
# Initialize the state of the variables. This initialization is not
# necessary but this shows you what value the variables initially have.
SET(CMAKE_REQUIRED_DEFINITIONS)
@@ -146,7 +139,12 @@ IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
# either of the following two, yet neither is supported as of 3.0.2
# - check_linker_flag - does not exist
# - try_compile - does not support linker flags
IF(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dead_strip")
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
# SunOS linker doesn't support --gc-sections
ELSE()
# Place the functions and data into separate sections, allowing the linker
# to garbage collect the unused ones.
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
@@ -155,10 +153,7 @@ IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
# Printing the discarded section is "too much", so enable on demand.
#SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Wl,--print-gc-sections")
#SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,--print-gc-sections")
ELSE()
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dead_strip")
ENDIF(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
ENDIF()
ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
CMAKE_C_COMPILER_ID MATCHES "^Clang$" AND NOT MSVC)
IF (CMAKE_C_COMPILER_ID MATCHES "^XL$")
@@ -238,6 +233,7 @@ OPTION(ENABLE_ZLIB "Enable the use of the system ZLIB library if found" ON)
OPTION(ENABLE_BZip2 "Enable the use of the system BZip2 library if found" ON)
OPTION(ENABLE_LIBXML2 "Enable the use of the system libxml2 library if found" ON)
OPTION(ENABLE_EXPAT "Enable the use of the system EXPAT library if found" ON)
OPTION(ENABLE_WIN32_XMLLITE "Enable the use of the Windows XmlLite library if found" ON)
OPTION(ENABLE_PCREPOSIX "Enable the use of the system PCREPOSIX library if found" ON)
OPTION(ENABLE_PCRE2POSIX "Enable the use of the system PCRE2POSIX library if found" ON)
OPTION(ENABLE_LIBGCC "Enable the use of the system LibGCC library if found" ON)
@@ -250,19 +246,19 @@ OPTION(ENABLE_CPIO "Enable cpio building" ON)
OPTION(ENABLE_CPIO_SHARED "Enable dynamic build of cpio" FALSE)
OPTION(ENABLE_CAT "Enable cat building" ON)
OPTION(ENABLE_CAT_SHARED "Enable dynamic build of cat" FALSE)
IF(WIN32 AND NOT CYGWIN)
SET(ENABLE_UNZIP FALSE)
SET(ENABLE_UNZIP_SHARED FALSE)
ELSE()
OPTION(ENABLE_UNZIP "Enable unzip building" ON)
OPTION(ENABLE_UNZIP_SHARED "Enable dynamic build of unzip" FALSE)
ENDIF()
OPTION(ENABLE_UNZIP "Enable unzip building" ON)
OPTION(ENABLE_UNZIP_SHARED "Enable dynamic build of unzip" FALSE)
OPTION(ENABLE_XATTR "Enable extended attribute support" ON)
OPTION(ENABLE_ACL "Enable ACL support" ON)
OPTION(ENABLE_ICONV "Enable iconv support" ON)
OPTION(ENABLE_TEST "Enable unit and regression tests" ON)
OPTION(ENABLE_COVERAGE "Enable code coverage (GCC only, automatically sets ENABLE_TEST to ON)" FALSE)
OPTION(ENABLE_INSTALL "Enable installing of libraries" ON)
OPTION(ENABLE_CLANG_TIDY "Enable custom build-time code health checks" OFF)
IF(WIN32 AND MSVC)
OPTION(MSVC_USE_STATIC_CRT "Use static CRT" OFF)
ENDIF()
SET(POSIX_REGEX_LIB "AUTO" CACHE STRING "Choose what library should provide POSIX regular expression support")
SET(ENABLE_SAFESEH "AUTO" CACHE STRING "Enable use of /SAFESEH linker flag (MSVC only)")
@@ -293,18 +289,6 @@ IF(WIN32)
SET(NTDDI_VERSION 0x06000100)
SET(_WIN32_WINNT 0x0600)
SET(WINVER 0x0600)
ELSEIF(WINDOWS_VERSION STREQUAL "VISTA")
SET(NTDDI_VERSION 0x06000000)
SET(_WIN32_WINNT 0x0600)
SET(WINVER 0x0600)
ELSEIF(WINDOWS_VERSION STREQUAL "WS03")
SET(NTDDI_VERSION 0x05020000)
SET(_WIN32_WINNT 0x0502)
SET(WINVER 0x0502)
ELSEIF(WINDOWS_VERSION STREQUAL "WINXP")
SET(NTDDI_VERSION 0x05010000)
SET(_WIN32_WINNT 0x0501)
SET(WINVER 0x0501)
ELSE(WINDOWS_VERSION STREQUAL "WIN10")
# Default to Windows Server 2003 API if we don't recognize the specifier
SET(NTDDI_VERSION 0x05020000)
@@ -353,35 +337,79 @@ INCLUDE(CheckTypeSize)
#
# Generate list.h
#
MACRO (GENERATE_LIST_H _listfile _cmlist __list_sources)
MACRO (GENERATE_LIST_H _listfile _cmlist _target __list_sources)
SET(_argv ${ARGV})
# Remove _listfile and _cmlist from _argv
LIST(REMOVE_AT _argv 0 1)
IF (NOT EXISTS "${_listfile}" OR
${_cmlist} IS_NEWER_THAN "${_listfile}")
MESSAGE(STATUS "Generating ${_listfile}")
FILE(WRITE ${_listfile} "")
FOREACH (testfile ${_argv})
IF (testfile MATCHES "^test_[^/]+[.]c$")
FILE(STRINGS ${testfile} testvar REGEX "^DEFINE_TEST")
FOREACH (deftest ${testvar})
FILE(APPEND ${_listfile} "${deftest}\n")
ENDFOREACH (deftest)
ENDIF (testfile MATCHES "^test_[^/]+[.]c$")
ENDFOREACH (testfile)
ENDIF (NOT EXISTS "${_listfile}" OR
${_cmlist} IS_NEWER_THAN "${_listfile}")
# Remove _listfile, _cmlist, and _target from _argv
LIST(REMOVE_AT _argv 0 1 2)
# Convert source paths to absolute so discover_tests.cmake can find them
# regardless of the working directory when cmake -P runs.
SET(_gl_abs_sources "")
FOREACH(_gl_src ${_argv})
IF(IS_ABSOLUTE "${_gl_src}")
LIST(APPEND _gl_abs_sources "${_gl_src}")
ELSE()
LIST(APPEND _gl_abs_sources "${CMAKE_CURRENT_SOURCE_DIR}/${_gl_src}")
ENDIF()
ENDFOREACH()
# Stamp out discover_tests.cmake with source list and output path baked in.
SET(SOURCES "${_gl_abs_sources}")
SET(OUTPUT "${_listfile}")
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/build/cmake/discover_tests.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/discover_tests.cmake
@ONLY)
UNSET(SOURCES)
UNSET(OUTPUT)
# list.h is regenerated at build time whenever any test .c file changes.
ADD_CUSTOM_COMMAND(
OUTPUT "${_listfile}"
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/discover_tests.cmake
DEPENDS ${_gl_abs_sources}
COMMENT "Generating ${_listfile}"
VERBATIM)
# Attaching list.h to the target tells CMake to build it before compiling.
TARGET_SOURCES(${_target} PRIVATE "${_listfile}")
ENDMACRO (GENERATE_LIST_H)
#
# Register individual tests with CTest by scanning DEFINE_TEST() declarations.
#
MACRO (DISCOVER_TESTS _component __list_sources)
IF(ENABLE_TEST)
SET(_sources ${ARGV})
LIST(REMOVE_AT _sources 0)
FOREACH (_src ${_sources})
IF (_src MATCHES "test_[^/]+\\.c$")
FILE(STRINGS "${_src}" _lines REGEX "^DEFINE_TEST\(.*\)")
FOREACH (_line ${_lines})
STRING(REGEX MATCH "DEFINE_TEST\((.*)\)" _full_match ${_line})
# CMake REGEX seems to handle ( and \( rather inconsistently...
# So we go through an extra dance to definitively strip the parens
STRING(REPLACE "(" "" _test_name_with_paren "${CMAKE_MATCH_1}")
STRING(REPLACE ")" "" _test_name "${_test_name_with_paren}")
SET(_full_test_name "${_component}_${_test_name}")
ADD_TEST(NAME ${_full_test_name}
COMMAND ${_component}_test -vv
-r ${CMAKE_CURRENT_SOURCE_DIR}
-s
${_test_name})
SET_TESTS_PROPERTIES(${_full_test_name} PROPERTIES SKIP_RETURN_CODE 2)
ENDFOREACH (_line)
ENDIF (_src MATCHES "test_[^/]+\\.c$")
ENDFOREACH (_src)
ENDIF(ENABLE_TEST)
ENDMACRO (DISCOVER_TESTS __list_sources)
#
# Generate installation rules for man pages.
#
MACRO (INSTALL_MAN __mans)
FOREACH (_man ${ARGV})
STRING(REGEX REPLACE "^.+[.]([1-9])" "\\1" _mansect ${_man})
INSTALL(FILES ${_man} DESTINATION "share/man/man${_mansect}")
ENDFOREACH (_man)
IF(ENABLE_INSTALL)
FOREACH (_man ${ARGV})
STRING(REGEX REPLACE "^.+[.]([1-9])" "\\1" _mansect ${_man})
INSTALL(FILES ${_man} DESTINATION "share/man/man${_mansect}")
ENDFOREACH (_man)
ENDIF(ENABLE_INSTALL)
ENDMACRO (INSTALL_MAN __mans)
#
# Find out what macro is needed to use libraries on Windows.
@@ -606,6 +634,7 @@ IF(ENABLE_LIBB2)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBB2 DEFAULT_MSG LIBB2_LIBRARY LIBB2_INCLUDE_DIR)
ELSE(ENABLE_LIBB2)
SET(LIBB2_FOUND FALSE) # Override cached value
UNSET(LIBB2_PKGCONFIG_VERSION CACHE)
ENDIF(ENABLE_LIBB2)
IF(LIBB2_FOUND)
SET(HAVE_LIBB2 1)
@@ -618,8 +647,13 @@ IF(LIBB2_FOUND)
SET(CMAKE_REQUIRED_INCLUDES ${LIBB2_INCLUDE_DIR})
CHECK_FUNCTION_EXISTS(blake2sp_init HAVE_LIBB2)
CMAKE_POP_CHECK_STATE()
pkg_check_modules(LIBB2 libb2)
IF(LIBB2_VERSION)
SET(LIBB2_PKGCONFIG_VERSION LIBB2_VERSION)
ENDIF(LIBB2_VERSION)
ELSE(LIBB2_FOUND)
SET(ARCHIVE_BLAKE2 TRUE)
UNSET(LIBB2_PKGCONFIG_VERSION CACHE)
ENDIF(LIBB2_FOUND)
#
# Find LZ4
@@ -667,7 +701,7 @@ IF(ENABLE_ZSTD)
ENDIF()
FIND_PATH(ZSTD_INCLUDE_DIR zstd.h HINTS ${PC_ZSTD_INCLUDEDIR} ${PC_ZSTD_INCLUDE_DIRS})
FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd HINTS ${PC_ZSTD_LIBDIR} ${PC_ZSTD_LIBRARY_DIRS})
FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd zstd_static HINTS ${PC_ZSTD_LIBDIR} ${PC_ZSTD_LIBRARY_DIRS})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
ELSE(ENABLE_ZSTD)
@@ -682,6 +716,7 @@ IF(ZSTD_FOUND)
SET(CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR})
CHECK_FUNCTION_EXISTS(ZSTD_decompressStream HAVE_LIBZSTD)
CHECK_FUNCTION_EXISTS(ZSTD_compressStream HAVE_ZSTD_compressStream)
CHECK_FUNCTION_EXISTS(ZSTD_minCLevel HAVE_ZSTD_minCLevel)
#
# TODO: test for static library.
#
@@ -690,7 +725,6 @@ ENDIF(ZSTD_FOUND)
MARK_AS_ADVANCED(CLEAR ZSTD_INCLUDE_DIR)
MARK_AS_ADVANCED(CLEAR ZSTD_LIBRARY)
#
# Check headers
#
@@ -736,6 +770,7 @@ CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h>
#include <linux/fs.h>
int main(void) { return FS_IOC_GETFLAGS; }" HAVE_WORKING_FS_IOC_GETFLAGS)
LA_CHECK_INCLUDE_FILE("intsafe.h" HAVE_INTSAFE_H)
LA_CHECK_INCLUDE_FILE("linux/magic.h" HAVE_LINUX_MAGIC_H)
LA_CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H)
LA_CHECK_INCLUDE_FILE("membership.h" HAVE_MEMBERSHIP_H)
@@ -750,7 +785,9 @@ LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H)
LA_CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
LA_CHECK_INCLUDE_FILE("spawn.h" HAVE_SPAWN_H)
LA_CHECK_INCLUDE_FILE("stdarg.h" HAVE_STDARG_H)
LA_CHECK_INCLUDE_FILE("stdckdint.h" HAVE_STDCKDINT_H)
LA_CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
LA_CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H)
LA_CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
LA_CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
LA_CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
@@ -784,12 +821,22 @@ IF(ENABLE_CNG)
LA_CHECK_INCLUDE_FILE("bcrypt.h" HAVE_BCRYPT_H)
IF(HAVE_BCRYPT_H)
LIST(APPEND ADDITIONAL_LIBS "bcrypt")
# bcrypt supports these algorithms on all available versions
SET(ARCHIVE_CRYPTO_MD5 1)
SET(ARCHIVE_CRYPTO_MD5_WIN 1)
SET(ARCHIVE_CRYPTO_SHA1 1)
SET(ARCHIVE_CRYPTO_SHA1_WIN 1)
SET(ARCHIVE_CRYPTO_SHA256 1)
SET(ARCHIVE_CRYPTO_SHA256_WIN 1)
SET(ARCHIVE_CRYPTO_SHA384 1)
SET(ARCHIVE_CRYPTO_SHA384_WIN 1)
SET(ARCHIVE_CRYPTO_SHA512 1)
SET(ARCHIVE_CRYPTO_SHA512_WIN 1)
ENDIF(HAVE_BCRYPT_H)
ELSE(ENABLE_CNG)
UNSET(HAVE_BCRYPT_H CACHE)
ENDIF(ENABLE_CNG)
# Following files need windows.h, so we should test it after windows.h test.
LA_CHECK_INCLUDE_FILE("wincrypt.h" HAVE_WINCRYPT_H)
LA_CHECK_INCLUDE_FILE("winioctl.h" HAVE_WINIOCTL_H)
#
@@ -817,10 +864,13 @@ IF(ENABLE_MBEDTLS)
LIST(APPEND ADDITIONAL_LIBS ${MBEDCRYPTO_LIBRARY})
INCLUDE_DIRECTORIES(${MBEDTLS_INCLUDE_DIRS})
CMAKE_PUSH_CHECK_STATE()
LIST(APPEND CMAKE_REQUIRED_INCLUDES ${MBEDTLS_INCLUDE_DIRS})
LA_CHECK_INCLUDE_FILE("mbedtls/aes.h" HAVE_MBEDTLS_AES_H)
LA_CHECK_INCLUDE_FILE("mbedtls/md.h" HAVE_MBEDTLS_MD_H)
LA_CHECK_INCLUDE_FILE("mbedtls/pkcs5.h" HAVE_MBEDTLS_PKCS5_H)
LA_CHECK_INCLUDE_FILE("mbedtls/version.h" HAVE_MBEDTLS_VERSION_H)
CMAKE_POP_CHECK_STATE()
ENDIF(MBEDTLS_FOUND)
MARK_AS_ADVANCED(CLEAR MBEDTLS_INCLUDE_DIRS)
@@ -837,6 +887,7 @@ IF(ENABLE_NETTLE)
LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES})
INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR})
CMAKE_PUSH_CHECK_STATE()
LIST(APPEND CMAKE_REQUIRED_INCLUDES ${NETTLE_INCLUDE_DIR})
LA_CHECK_INCLUDE_FILE("nettle/aes.h" HAVE_NETTLE_AES_H)
LA_CHECK_INCLUDE_FILE("nettle/hmac.h" HAVE_NETTLE_HMAC_H)
@@ -844,6 +895,8 @@ IF(ENABLE_NETTLE)
LA_CHECK_INCLUDE_FILE("nettle/pbkdf2.h" HAVE_NETTLE_PBKDF2_H)
LA_CHECK_INCLUDE_FILE("nettle/ripemd160.h" HAVE_NETTLE_RIPEMD160_H)
LA_CHECK_INCLUDE_FILE("nettle/sha.h" HAVE_NETTLE_SHA_H)
LA_CHECK_INCLUDE_FILE("nettle/version.h" HAVE_NETTLE_VERSION_H)
CMAKE_POP_CHECK_STATE()
ENDIF(NETTLE_FOUND)
MARK_AS_ADVANCED(CLEAR NETTLE_INCLUDE_DIR)
@@ -860,10 +913,15 @@ IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
SET(HAVE_LIBCRYPTO 1)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_CRYPTO_LIBRARY})
CMAKE_PUSH_CHECK_STATE()
SET(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
LA_CHECK_INCLUDE_FILE("openssl/evp.h" HAVE_OPENSSL_EVP_H)
LA_CHECK_INCLUDE_FILE("openssl/opensslv.h" HAVE_OPENSSL_OPENSSLV_H)
CHECK_FUNCTION_EXISTS(PKCS5_PBKDF2_HMAC_SHA1 HAVE_PKCS5_PBKDF2_HMAC_SHA1)
CMAKE_POP_CHECK_STATE()
ENDIF(OPENSSL_FOUND)
ELSE()
SET(OPENSSL_FOUND FALSE) # Override cached value
@@ -881,6 +939,18 @@ IF(NOT OPENSSL_FOUND)
ENDIF(LIBMD_FOUND)
ENDIF(NOT OPENSSL_FOUND)
# libbsd for readpassphrase on Haiku
IF("${CMAKE_SYSTEM_NAME}" MATCHES "Haiku")
MESSAGE(STATUS "Adding libbsd for Haiku")
CMAKE_PUSH_CHECK_STATE()
SET(CMAKE_REQUIRED_LIBRARIES "bsd")
FIND_LIBRARY(LIBBSD_LIBRARY NAMES bsd)
LIST(APPEND ADDITIONAL_LIBS ${LIBBSD_LIBRARY})
CMAKE_POP_CHECK_STATE()
ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "Haiku")
#
# How to prove that CRYPTO functions, which have several names on various
# platforms, just see if archive_digest.c can compile and link against
@@ -989,86 +1059,6 @@ main(int argc, char **argv)
ENDFOREACH(ALGORITHM ${ALGORITHMS})
ENDMACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION)
#
# CRYPTO functions on Windows is defined at archive_windows.c, thus we do not
# need the test what the functions can be mapped to archive_{crypto name}_init,
# archive_{crypto name}_update and archive_{crypto name}_final.
# The functions on Windows use CALG_{crypto name} macro to create a crypt object
# and then we need to know what CALG_{crypto name} macros is available to show
# ARCHIVE_CRYPTO_{crypto name}_WIN macros because Windows 2000 and earlier version
# of Windows XP do not support SHA256, SHA384 and SHA512.
#
MACRO(CHECK_CRYPTO_WIN CRYPTO_LIST)
IF(WIN32 AND NOT CYGWIN)
FOREACH(CRYPTO ${CRYPTO_LIST})
IF(NOT ARCHIVE_CRYPTO_${CRYPTO})
IF(NOT DEFINED ARCHIVE_CRYPTO_${CRYPTO}_WIN)
STRING(TOUPPER "${CRYPTO}" crypto)
SET(ALGID "")
IF ("${CRYPTO}" MATCHES "^MD5$")
SET(ALGID "CALG_MD5")
ENDIF ("${CRYPTO}" MATCHES "^MD5$")
IF ("${CRYPTO}" MATCHES "^SHA1$")
SET(ALGID "CALG_SHA1")
ENDIF ("${CRYPTO}" MATCHES "^SHA1$")
IF ("${CRYPTO}" MATCHES "^SHA256$")
SET(ALGID "CALG_SHA_256")
ENDIF ("${CRYPTO}" MATCHES "^SHA256$")
IF ("${CRYPTO}" MATCHES "^SHA384$")
SET(ALGID "CALG_SHA_384")
ENDIF ("${CRYPTO}" MATCHES "^SHA384$")
IF ("${CRYPTO}" MATCHES "^SHA512$")
SET(ALGID "CALG_SHA_512")
ENDIF ("${CRYPTO}" MATCHES "^SHA512$")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h)
FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h"
CONFDEFS_H)
SET(SOURCE "${CONFDEFS_H}
#define ${crypto}_COMPILE_TEST
#include <windows.h>
#include <wincrypt.h>
int
main(int argc, char **argv)
{
return ${ALGID};
}
")
SET(SOURCE_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_win.c")
FILE(WRITE "${SOURCE_FILE}" "${SOURCE}")
MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN")
TRY_COMPILE(ARCHIVE_CRYPTO_${CRYPTO}_WIN
${CMAKE_BINARY_DIR}
${SOURCE_FILE}
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive"
OUTPUT_VARIABLE OUTPUT)
IF (ARCHIVE_CRYPTO_${CRYPTO}_WIN)
MESSAGE(STATUS
"Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN -- found")
SET(ARCHIVE_CRYPTO_${CRYPTO} 1)
ELSE (ARCHIVE_CRYPTO_${CRYPTO}_WIN)
MESSAGE(STATUS
"Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN -- not found")
FILE(APPEND
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN failed with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
ENDIF (ARCHIVE_CRYPTO_${CRYPTO}_WIN)
ENDIF(NOT DEFINED ARCHIVE_CRYPTO_${CRYPTO}_WIN)
ENDIF(NOT ARCHIVE_CRYPTO_${CRYPTO})
ENDFOREACH(CRYPTO)
ENDIF(WIN32 AND NOT CYGWIN)
ENDMACRO(CHECK_CRYPTO_WIN CRYPTO_LIST)
#
# Find iconv
# POSIX defines the second arg as const char **
@@ -1083,8 +1073,8 @@ MACRO(CHECK_ICONV LIB TRY_ICONV_CONST)
CMAKE_C_COMPILER_ID MATCHES "^Clang$")
#
# During checking iconv proto type, we should use -Werror to avoid the
# success of iconv detection with a warning which success is a miss
# detection. So this needs for all build mode(even it's a release mode).
# success of iconv detection with a warning, which would be a false
# positive. So this is needed for all build modes, even in release mode.
#
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
@@ -1155,6 +1145,7 @@ IF(ENABLE_ICONV)
CHECK_ICONV("libiconv" "const")
CHECK_ICONV("libiconv" "")
IF (HAVE_ICONV)
SET(HAVE_LIBICONV 1)
LIST(APPEND ADDITIONAL_LIBS ${LIBICONV_PATH})
ENDIF(HAVE_ICONV)
ENDIF(NOT HAVE_ICONV AND LIBICONV_PATH)
@@ -1198,6 +1189,7 @@ ELSE(ENABLE_ICONV)
# (once enabled).
UNSET(HAVE_LOCALE_CHARSET CACHE)
UNSET(HAVE_ICONV CACHE)
UNSET(HAVE_LIBICONV CACHE)
UNSET(HAVE_ICONV_libc_ CACHE)
UNSET(HAVE_ICONV_libc_const CACHE)
UNSET(HAVE_ICONV_libiconv_ CACHE)
@@ -1227,6 +1219,7 @@ IF(LIBXML2_FOUND)
SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR})
CHECK_INCLUDE_FILES("libxml/xmlreader.h" HAVE_LIBXML_XMLREADER_H)
CHECK_INCLUDE_FILES("libxml/xmlwriter.h" HAVE_LIBXML_XMLWRITER_H)
CHECK_INCLUDE_FILES("libxml/xmlversion.h" HAVE_LIBXML_XMLVERSION_H)
# Test if a macro is needed for the library.
TRY_MACRO_FOR_LIBRARY(
"${ICONV_INCLUDE_DIR};${LIBXML2_INCLUDE_DIR}"
@@ -1254,6 +1247,25 @@ ELSE(LIBXML2_FOUND)
SET(HAVE_LIBEXPAT 1)
LA_CHECK_INCLUDE_FILE("expat.h" HAVE_EXPAT_H)
CMAKE_POP_CHECK_STATE() # Restore the state of the variables
ELSE(EXPAT_FOUND)
IF(WIN32 AND ENABLE_WIN32_XMLLITE)
# Check linkage as well; versions of mingw-w64 before v11.0.0
# do not contain an import library for xmllite.
cmake_push_check_state()
SET(CMAKE_REQUIRED_LIBRARIES "xmllite" "uuid")
check_c_source_compiles("
#include <initguid.h>
#include <xmllite.h>
int main() {
return CreateXmlReader(&IID_IXmlReader, NULL, NULL);
}
" HAVE_XMLLITE_H)
cmake_pop_check_state()
IF(HAVE_XMLLITE_H)
SET(XMLLITE_FOUND TRUE)
LIST(APPEND ADDITIONAL_LIBS "xmllite" "uuid")
ENDIF()
ENDIF()
ENDIF(EXPAT_FOUND)
ENDIF(LIBXML2_FOUND)
MARK_AS_ADVANCED(CLEAR LIBXML2_INCLUDE_DIR)
@@ -1455,6 +1467,8 @@ CHECK_FUNCTION_EXISTS_GLIBC(arc4random_buf HAVE_ARC4RANDOM_BUF)
CHECK_FUNCTION_EXISTS_GLIBC(chflags HAVE_CHFLAGS)
CHECK_FUNCTION_EXISTS_GLIBC(chown HAVE_CHOWN)
CHECK_FUNCTION_EXISTS_GLIBC(chroot HAVE_CHROOT)
CHECK_FUNCTION_EXISTS_GLIBC(closefrom HAVE_CLOSEFROM)
CHECK_FUNCTION_EXISTS_GLIBC(close_range HAVE_CLOSE_RANGE)
CHECK_FUNCTION_EXISTS_GLIBC(ctime_r HAVE_CTIME_R)
CHECK_FUNCTION_EXISTS_GLIBC(fchdir HAVE_FCHDIR)
CHECK_FUNCTION_EXISTS_GLIBC(fchflags HAVE_FCHFLAGS)
@@ -1472,15 +1486,20 @@ CHECK_FUNCTION_EXISTS_GLIBC(ftruncate HAVE_FTRUNCATE)
CHECK_FUNCTION_EXISTS_GLIBC(futimens HAVE_FUTIMENS)
CHECK_FUNCTION_EXISTS_GLIBC(futimes HAVE_FUTIMES)
CHECK_FUNCTION_EXISTS_GLIBC(futimesat HAVE_FUTIMESAT)
CHECK_FUNCTION_EXISTS_GLIBC(getegid HAVE_GETEGID)
CHECK_FUNCTION_EXISTS_GLIBC(geteuid HAVE_GETEUID)
CHECK_FUNCTION_EXISTS_GLIBC(getgrgid_r HAVE_GETGRGID_R)
CHECK_FUNCTION_EXISTS_GLIBC(getgrnam_r HAVE_GETGRNAM_R)
CHECK_FUNCTION_EXISTS_GLIBC(getline HAVE_GETLINE)
CHECK_FUNCTION_EXISTS_GLIBC(getpid HAVE_GETPID)
CHECK_FUNCTION_EXISTS_GLIBC(getpwnam_r HAVE_GETPWNAM_R)
CHECK_FUNCTION_EXISTS_GLIBC(getpwuid_r HAVE_GETPWUID_R)
CHECK_FUNCTION_EXISTS_GLIBC(getpid HAVE_GETPID)
CHECK_FUNCTION_EXISTS_GLIBC(getresgid HAVE_GETRESGID)
CHECK_FUNCTION_EXISTS_GLIBC(getresuid HAVE_GETRESUID)
CHECK_FUNCTION_EXISTS_GLIBC(gettimeofday HAVE_GETTIMEOFDAY)
CHECK_FUNCTION_EXISTS_GLIBC(getvfsbyname HAVE_GETVFSBYNAME)
CHECK_FUNCTION_EXISTS_GLIBC(gmtime_r HAVE_GMTIME_R)
CHECK_FUNCTION_EXISTS_GLIBC(issetugid HAVE_ISSETUGID)
CHECK_FUNCTION_EXISTS_GLIBC(lchflags HAVE_LCHFLAGS)
CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD)
CHECK_FUNCTION_EXISTS_GLIBC(lchown HAVE_LCHOWN)
@@ -1499,6 +1518,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(nl_langinfo HAVE_NL_LANGINFO)
CHECK_FUNCTION_EXISTS_GLIBC(openat HAVE_OPENAT)
CHECK_FUNCTION_EXISTS_GLIBC(pipe HAVE_PIPE)
CHECK_FUNCTION_EXISTS_GLIBC(poll HAVE_POLL)
CHECK_FUNCTION_EXISTS_GLIBC(posix_spawn HAVE_POSIX_SPAWN)
CHECK_FUNCTION_EXISTS_GLIBC(posix_spawnp HAVE_POSIX_SPAWNP)
CHECK_FUNCTION_EXISTS_GLIBC(readlink HAVE_READLINK)
CHECK_FUNCTION_EXISTS_GLIBC(readpassphrase HAVE_READPASSPHRASE)
@@ -1516,6 +1536,8 @@ CHECK_FUNCTION_EXISTS_GLIBC(strnlen HAVE_STRNLEN)
CHECK_FUNCTION_EXISTS_GLIBC(strrchr HAVE_STRRCHR)
CHECK_FUNCTION_EXISTS_GLIBC(symlink HAVE_SYMLINK)
CHECK_FUNCTION_EXISTS_GLIBC(sysconf HAVE_SYSCONF)
CHECK_FUNCTION_EXISTS_GLIBC(tcgetattr HAVE_TCGETATTR)
CHECK_FUNCTION_EXISTS_GLIBC(tcsetattr HAVE_TCSETATTR)
CHECK_FUNCTION_EXISTS_GLIBC(timegm HAVE_TIMEGM)
CHECK_FUNCTION_EXISTS_GLIBC(tzset HAVE_TZSET)
CHECK_FUNCTION_EXISTS_GLIBC(unlinkat HAVE_UNLINKAT)
@@ -1525,9 +1547,9 @@ CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES)
CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT)
CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK)
CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB)
CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP)
CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY)
CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN)
check_symbol_exists(wcscmp wchar.h HAVE_WCSCMP)
check_symbol_exists(wcscpy wchar.h HAVE_WCSCPY)
check_symbol_exists(wcslen wchar.h HAVE_WCSLEN)
CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB)
CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64)
CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE)
@@ -1560,12 +1582,6 @@ CHECK_C_SOURCE_COMPILES(
"#include <sys/types.h>\n#include <sys/mount.h>\nint main(void) { struct statfs s; return sizeof(s);}"
HAVE_STRUCT_STATFS)
# Make sure we have the POSIX version of readdir_r, not the
# older 2-argument version.
CHECK_C_SOURCE_COMPILES(
"#include <dirent.h>\nint main() {DIR *d = opendir(\".\"); struct dirent e,*r; return readdir_r(d,&e,&r);}"
HAVE_READDIR_R)
# dirfd can be either a function or a macro.
CHECK_C_SOURCE_COMPILES(
"#include <dirent.h>\nint main() {DIR *d = opendir(\".\"); return dirfd(d);}"
@@ -1805,11 +1821,16 @@ IF(ENABLE_XATTR)
CHECK_LIBRARY_EXISTS(attr "setxattr" "" HAVE_LIBATTR)
IF(HAVE_LIBATTR)
SET(CMAKE_REQUIRED_LIBRARIES "attr")
ELSE()
pkg_check_modules(LIBATTR libattr)
IF(LIBATTR_VERSION)
SET(LIBATTR_PKGCONFIG_VERSION ${LIBATTR_VERSION})
ENDIF(LIBATTR_VERSION)
ELSE(HAVE_LIBATTR)
CHECK_LIBRARY_EXISTS(gnu "setxattr" "" HAVE_LIBATTR_GNU)
IF(HAVE_LIBATTR_GNU)
SET(CMAKE_REQUIRED_LIBRARIES "gnu")
ENDIF()
UNSET(LIBATTR_PKGCONFIG_VERSION CACHE)
ENDIF(HAVE_LIBATTR)
CHECK_SYMBOL_EXISTS(EXTATTR_NAMESPACE_USER "sys/types.h;sys/extattr.h" HAVE_DECL_EXTATTR_NAMESPACE_USER)
CHECK_SYMBOL_EXISTS(XATTR_NOFOLLOW "sys/xattr.h" HAVE_DECL_XATTR_NOFOLLOW)
@@ -1927,6 +1948,12 @@ IF(ENABLE_ACL)
SET(CMAKE_REQUIRED_LIBRARIES "acl")
FIND_LIBRARY(ACL_LIBRARY NAMES acl)
LIST(APPEND ADDITIONAL_LIBS ${ACL_LIBRARY})
pkg_check_modules(LIBACL libacl)
IF(LIBACL_VERSION)
SET(LIBACL_PKGCONFIG_VERSION ${LIBACL_VERSION})
ENDIF(LIBACL_VERSION)
ELSE(HAVE_LIBACL)
UNSET(LIBACL_PKGCONFIG_VERSION CACHE)
ENDIF(HAVE_LIBACL)
CHECK_TYPE_EXISTS(acl_t "sys/types.h;sys/acl.h" HAVE_ACL_T)
@@ -2066,6 +2093,12 @@ int main(void) { return ACL_SYNCHRONIZE; }" HAVE_DECL_ACL_SYNCHRONIZE)
SET(CMAKE_REQUIRED_LIBRARIES "richacl")
FIND_LIBRARY(RICHACL_LIBRARY NAMES richacl)
LIST(APPEND ADDITIONAL_LIBS ${RICHACL_LIBRARY})
pkg_check_modules(LIBRICHACL librichacl)
IF(LIBRICHACL_VERSION)
SET(LIBRICHACL_PKGCONFIG_VERSION ${LIBRICHACL_VERSION})
ENDIF(LIBRICHACL_VERSION)
ELSE(HAVE_LIBRICHACL)
UNSET(LIBRICHACL_PKGCONFIG_VERSION CACHE)
ENDIF(HAVE_LIBRICHACL)
CHECK_STRUCT_HAS_MEMBER("struct richace" e_type "sys/richacl.h"
@@ -2129,18 +2162,19 @@ ENDIF(ENABLE_ACL)
# Check MD5/RMD160/SHA support
# NOTE: Crypto checks must be run last before generating config.h
#
CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" LIBC)
CHECK_CRYPTO("SHA256;SHA384;SHA512" LIBC2)
CHECK_CRYPTO("SHA256;SHA384;SHA512" LIBC3)
CHECK_CRYPTO("MD5;SHA1;SHA256;SHA384;SHA512" LIBSYSTEM)
CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" MBEDTLS)
CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" NETTLE)
CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" OPENSSL)
IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
CHECK_CRYPTO("MD5;SHA1;SHA256;SHA384;SHA512" LIBSYSTEM)
ELSE()
CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" LIBC)
CHECK_CRYPTO("SHA256;SHA384;SHA512" LIBC2)
CHECK_CRYPTO("SHA256;SHA384;SHA512" LIBC3)
CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" MBEDTLS)
CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" NETTLE)
CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" OPENSSL)
# Libmd has to be probed after OpenSSL.
CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA512" LIBMD)
CHECK_CRYPTO_WIN("MD5;SHA1;SHA256;SHA384;SHA512")
# Libmd has to be probed after OpenSSL.
CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA512" LIBMD)
ENDIF()
# Check visibility annotations
SET(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
@@ -2165,7 +2199,7 @@ INCLUDE(CreatePkgConfigFile)
#
# Register installation of PDF documents.
#
IF(WIN32 AND NOT CYGWIN)
IF(WIN32 AND NOT CYGWIN AND ENABLE_INSTALL)
#
# On Windows platform, It's better that we install PDF documents
# on one's computer.
@@ -2177,7 +2211,7 @@ IF(WIN32 AND NOT CYGWIN)
FILES_MATCHING PATTERN "*.pdf"
)
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf)
ENDIF(WIN32 AND NOT CYGWIN)
ENDIF(WIN32 AND NOT CYGWIN AND ENABLE_INSTALL)
#
#
#
@@ -2187,11 +2221,6 @@ IF(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
ENDIF(MSVC)
IF(APPLE)
# CC_MD5_Init() functions are deprecated on macOS 10.15, but we want to use them
ADD_DEFINITIONS(-Wno-deprecated-declarations)
ENDIF(APPLE)
OPTION(DONT_FAIL_ON_CRC_ERROR "Ignore CRC errors during parsing (For fuzzing)" OFF)
IF(DONT_FAIL_ON_CRC_ERROR)
ADD_DEFINITIONS(-DDONT_FAIL_ON_CRC_ERROR=1)
@@ -2201,6 +2230,13 @@ IF(ENABLE_TEST)
ADD_CUSTOM_TARGET(run_all_tests)
ENDIF(ENABLE_TEST)
IF(ENABLE_CLANG_TIDY)
IF(NOT CLANG_TIDY_PATH)
SET(CLANG_TIDY_PATH clang-tidy)
ENDIF(NOT CLANG_TIDY_PATH)
SET(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_PATH})
ENDIF(ENABLE_CLANG_TIDY)
add_subdirectory(libarchive)
add_subdirectory(cat)
add_subdirectory(tar)
+1 -1
View File
@@ -20,7 +20,7 @@ the actual statements in the files are controlling.
libarchive/mtree.5
* The following source files are in the public domain:
libarchive/archive_getdate.c
libarchive/archive_parse_date.c
* The following source files are triple-licensed with the ability to choose
from CC0 1.0 Universal, OpenSSL or Apache 2.0 licenses:
+369 -119
View File
File diff suppressed because it is too large. Load diff
+28
View File
@@ -1,3 +1,31 @@
Jul 28, 2026: libarchive 3.8.9 released
Jun 23, 2026: libarchive 3.8.8 released
Apr 13, 2026: libarchive 3.8.7 released
Mar 10, 2026: libarchive 3.8.6 released
Jan 05, 2026: libarchive 3.8.5 released
Dec 01, 2025: libarchive 3.8.4 released
Nov 17, 2025: libarchive 3.8.3 released
Oct 15, 2025: libarchive 3.8.2 released
Jun 01, 2025: libarchive 3.8.1 released
May 20, 2025: libarchive 3.8.0 released
Mar 30, 2025: libarchive 3.7.9 released
Mar 20, 2025: libarchive 3.7.8 released
Oct 13, 2024: libarchive 3.7.7 released
Sep 23, 2024: libarchive 3.7.6 released
Sep 13, 2024: libarchive 3.7.5 released
Apr 26, 2024: libarchive 3.7.4 released
+14 -8
View File
@@ -37,10 +37,13 @@ The top-level directory contains the following information files:
* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL
* **configure** - configuration script, see INSTALL for details. If your copy of the source lacks a `configure` script, you can try to construct it by running the script in `build/autogen.sh` (or use `cmake`).
The following files in the top-level directory are used by the 'configure' script:
The following files in the top-level directory are related to the 'configure' script and are only needed by maintainers:
* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this distribution, only needed by maintainers
* `Makefile.in`, `config.h.in` - templates used by configure script
* `configure.ac` - used (by autoconf) to build the configure script and related files
* `Makefile.am` - used (by automake) to generate Makefile.in
* `aclocal.m4` - auto-generated file (created by aclocal) used to build the configure script
* `Makefile.in` - auto-generated template (created by automake) used by the configure script to create Makefile
* `config.h.in` - auto-generated template (created by autoheader) used by the configure script to create config.h
## Documentation
@@ -85,13 +88,14 @@ Currently, the library automatically detects and reads the following formats:
* PWB binary cpio
* ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
* ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives)
* ZIPX archives (with support for bzip2, ppmd8, lzma and xz compressed entries)
* ZIPX archives (with support for bzip2, zstd, ppmd8, lzma and xz compressed entries)
* GNU and BSD 'ar' archives
* 'mtree' format
* 7-Zip archives (including archives that use zstandard compression)
* Microsoft CAB format
* LHA and LZH archives
* RAR and RAR 5.0 archives (with some limitations due to RAR's proprietary status)
* WARC archives
* XAR archives
The library also detects and handles any of the following before evaluating the archive:
@@ -120,15 +124,18 @@ The library can create archives in any of the following formats:
* PWB binary cpio
* shar archives
* ZIP archives (with uncompressed or "deflate" compressed entries)
* ZIPX archives (with bzip2, zstd, lzma or xz compressed entries)
* GNU and BSD 'ar' archives
* 'mtree' format
* ISO9660 format
* 7-Zip archives
* 7-Zip archives (including archives that use zstandard compression)
* WARC archives
* XAR archives
When creating archives, the result can be filtered with any of the following:
* uuencode
* base64
* gzip compression
* bzip2 compression
* compress/LZW compression
@@ -187,7 +194,7 @@ questions we are asked about libarchive:
libraries. This also reduces the size of statically-linked
binaries in environments where that matters.
* The library is generally _thread safe_ depending on the platform:
* The library is generally _thread-safe_ depending on the platform:
it does not define any global variables of its own. However, some
platforms do not provide fully thread-safe versions of key C library
functions. On those platforms, libarchive will use the non-thread-safe
@@ -210,7 +217,7 @@ questions we are asked about libarchive:
multiple threads. Of course, those modules are completely
optional and you can use the rest of libarchive without them.
* The library is _not_ thread aware, however. It does no locking
* The library is _not_ thread-aware, however. It does no locking
or thread management of any kind. If you create a libarchive
object and need to access it from multiple threads, you will
need to provide your own locking.
@@ -241,4 +248,3 @@ questions we are asked about libarchive:
appropriate. It has many advantages over other tar formats
(including the legacy GNU tar format) and is widely supported by
current tar implementations.
+13 -6
View File
@@ -1,9 +1,10 @@
# Security Policy
If you have discovered a security vulnerability in this project, please report it
privately. **Do not disclose it as a public issue.** This gives us time to work with you
to fix the issue before public exposure, reducing the chance that the exploit will be
used before a patch is released.
If you have discovered a security vulnerability in this project,
please report it privately.
**Do not disclose it as a public issue.**
This gives us time to work with you to fix the issue before public exposure,
reducing the chance that the exploit will be used before a patch is released.
You may submit the report in the following ways:
@@ -15,5 +16,11 @@ Please provide the following information in your report:
- A description of the vulnerability and its impact
- How to reproduce the issue
This project is maintained by volunteers on a reasonable-effort basis. As such, we ask
that you give me 90 days to work on a fix before public exposure.
While we welcome all reports, we can act most quickly if the report
includes a complete libarchive test case and a proposed fix.
See [doc/WRITING_TESTS.md](doc/WRITING_TESTS.md) for guidance on creating a reproduction test case.
You can provide the test case and proposed fix as separate patch files
prepared with `git format-patch` or `git diff`.
This project is maintained by volunteers on a reasonable-effort basis.
We ask that you give us 90 days to work on a fix before public exposure.
+2 -2
View File
@@ -1,7 +1,7 @@
#!/bin/sh
set -eu
PATH=/usr/local/gnu-autotools/bin/:$PATH
export PATH
# Start from one level above the build directory
if [ -f version ]; then
@@ -49,7 +49,7 @@ perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_S\]),.*\)/$1,['"$VS"'])/' conf
perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_N\]),.*\)/$1,['"$VN"'])/' configure.ac
# Remove developer CFLAGS if a release build is being made
if [ -n "${MAKE_LIBARCHIVE_RELEASE}" ]; then
if [ -n "${MAKE_LIBARCHIVE_RELEASE:-}" ]; then
perl -p -i -e "s/^(DEV_CFLAGS.*)/# \$1/" Makefile.am
perl -p -i -e 's/CMAKE_BUILD_TYPE "[A-Za-z]*"/CMAKE_BUILD_TYPE "Release"/' CMakeLists.txt
fi
+1
View File
@@ -1,4 +1,5 @@
#!/bin/sh +v
set -eu
# Start from the build directory, where the version file is located
if [ -f build/version ]; then
+19 -8
View File
@@ -12,14 +12,18 @@
# MAKE_ARGS= # make arguments
# DEBUG= # set -g -fsanitize=address flags
set -eu
ACTIONS=
if [ -n "${BUILD_SYSTEM}" ]; then
if [ -n "${BUILD_SYSTEM:-}" ]; then
BS="${BUILD_SYSTEM}"
fi
BS="${BS:-autotools}"
MAKE="${MAKE:-make}"
CMAKE="${CMAKE:-cmake}"
CMAKE_ARGS="${CMAKE_ARGS:-}"
CONFIGURE_ARGS="${CONFIGURE_ARGS:-}"
CURDIR=`pwd`
SRCDIR="${SRCDIR:-`pwd`}"
RET=0
@@ -74,7 +78,7 @@ while getopts a:b:c:d:s: opt; do
;;
esac
done
case "${CRYPTO}" in
case "${CRYPTO:-}" in
mbedtls)
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_OPENSSL=OFF -DENABLE_MBEDTLS=ON"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --without-openssl --with-mbedtls"
@@ -84,15 +88,21 @@ case "${CRYPTO}" in
CONFIGURE_ARGS="${CONFIGURE_ARGS} --without-openssl --with-nettle"
;;
esac
if [ -z "${MAKE_ARGS}" ]; then
if [ -z "${MAKE_ARGS:-}" ]; then
if [ "${BS}" = "autotools" ]; then
MAKE_ARGS="V=1"
elif [ "${BS}" = "cmake" ]; then
MAKE_ARGS="VERBOSE=1"
fi
fi
if [ -n "${DEBUG}" ]; then
if [ -n "${CFLAGS}" ]; then
if [ -d /opt/homebrew/include ]; then
export CFLAGS="${CFLAGS:-} -I/opt/homebrew/include"
fi
if [ -d /opt/homebrew/lib ]; then
export LDFLAGS="${LDFLAGS:-} -L/opt/homebrew/lib"
fi
if [ -n "${DEBUG:-}" ]; then
if [ -n "${CFLAGS:-}" ]; then
export CFLAGS="${CFLAGS} -g -fsanitize=address"
else
export CFLAGS="-g -fsanitize=address"
@@ -104,7 +114,7 @@ fi
if [ -z "${BS}" ]; then
inputerror "Missing build system (-b) parameter"
fi
if [ -z "${BUILDDIR}" ]; then
if [ -z "${BUILDDIR:-}" ]; then
BUILDDIR="${CURDIR}/build_ci/${BS}"
fi
mkdir -p "${BUILDDIR}"
@@ -141,18 +151,19 @@ for action in ${ACTIONS}; do
;;
esac
RET="$?"
find ${TMPDIR:-/tmp} -path '*_test.*' -name '*.log' -print -exec cat {} \;
find ${TMPDIR:-/tmp} -path '*_test.*' -name '*.log' -print -exec cat {} \; 2>/dev/null || /bin/true
;;
install)
${MAKE} ${MAKE_ARGS} install DESTDIR="${BUILDDIR}/destdir"
RET="$?"
cd "${BUILDDIR}/destdir" && ls -lR .
./usr/local/bin/bsdtar --version
;;
distcheck)
${MAKE} ${MAKE_ARGS} distcheck || (
RET="$?"
find . -name 'test-suite.log' -print -exec cat {} \;
find ${TMPDIR:-/tmp} -path '*_test.*' -name '*.log' -print -exec cat {} \;
find ${TMPDIR:-/tmp} -path '*_test.*' -name '*.log' -print -exec cat {} \; 2>/dev/null || /bin/true
exit "${RET}"
)
RET="$?"
-4
View File
@@ -1,4 +0,0 @@
FROM cirrusci/windowsservercore:2019
RUN choco install -y --no-progress cygwin
RUN C:\tools\cygwin\cygwinsetup.exe -q -P make,autoconf,automake,cmake,gcc-core,binutils,libtool,pkg-config,bison,sharutils,zlib-devel,libbz2-devel,liblzma-devel,liblz4-devel,libiconv-devel,libxml2-devel,libzstd-devel,libssl-devel
-3
View File
@@ -1,3 +0,0 @@
FROM fedora:31
RUN dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison sharutils pkgconf libacl-devel libasan librichacl-devel bzip2-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel nettle-devel mbedtls-devel
@@ -1,3 +0,0 @@
FROM fedora:31
RUN dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison sharutils pkgconf libacl-devel libasan librichacl-devel bzip2-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel groff ghostscript xz zip
-8
View File
@@ -1,8 +0,0 @@
FROM cirrusci/windowsservercore:2019
RUN choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=User' cmake
RUN choco install -y --no-progress mingw
RUN curl -o zlib-1.2.11.tar.gz https://www.zlib.net/zlib-1.2.11.tar.gz
RUN tar -x -f zlib-1.2.11.tar.gz
RUN cd zlib-1.2.11 && cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" . && mingw32-make && mingw32-make install
RUN del /f /q /s zlib-1.2.11 zlib-1.2.11.tar.gz
-9
View File
@@ -1,9 +0,0 @@
FROM cirrusci/windowsservercore:2019
RUN choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=User' cmake
RUN choco install -y --no-progress visualstudio2017community
RUN choco install -y --no-progress visualstudio2017-workload-vctools
RUN curl -o zlib-1.2.11.tar.gz https://www.zlib.net/zlib-1.2.11.tar.gz
RUN tar -x -f zlib-1.2.11.tar.gz
RUN cd zlib-1.2.11 && cmake -G "Visual Studio 15 2017" . && cmake --build . --target ALL_BUILD --config Release && cmake --build . --target INSTALL --config Release
RUN del /f /q /s zlib-1.2.11 zlib-1.2.11.tar.gz
-12
View File
@@ -1,12 +0,0 @@
FROM cirrusci/windowsservercore:2019
RUN choco install -y --no-progress mingw
RUN choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=User' cmake
RUN choco install -y --no-progress visualstudio2017community
RUN choco install -y --no-progress visualstudio2017-workload-vctools
RUN curl -o zlib-1.2.11.tar.gz https://www.zlib.net/zlib-1.2.11.tar.gz
RUN tar -x -f zlib-1.2.11.tar.gz
RUN cd zlib-1.2.11 && cmake -G "Visual Studio 15 2017" . && cmake --build . --target ALL_BUILD --config Release && cmake --build . --target INSTALL --config Release
RUN del /f /q /s zlib-1.2.11 zlib-1.2.11.tar.gz
RUN choco install -y --no-progress cygwin
RUN C:\tools\cygwin\cygwinsetup.exe -q -P make,autoconf,automake,cmake,gcc-core,binutils,libtool,pkg-config,bison,sharutils,zlib-devel,libbz2-devel,liblzma-devel,liblz4-devel,libiconv-devel,libxml2-devel,libzstd-devel,libssl-devel
-122
View File
@@ -1,122 +0,0 @@
@ECHO OFF
SET ZLIB_VERSION=1.2.11
IF NOT "%BE%"=="cygwin-gcc" (
IF NOT "%BE%"=="mingw-gcc" (
IF NOT "%BE%"=="msvc" (
ECHO Environment variable BE must be cygwin-gcc, mingw-gcc or msvc
EXIT /b 1
)
)
)
IF "%1%"=="prepare" (
IF "%BE%"=="cygwin-gcc" (
@ECHO ON
choco install -y --no-progress cygwin || EXIT /b 1
C:\tools\cygwin\cygwinsetup.exe -q -P make,autoconf,automake,cmake,gcc-core,binutils,libtool,pkg-config,bison,sharutils,zlib-devel,libbz2-devel,liblzma-devel,liblz4-devel,libiconv-devel,libxml2-devel,libzstd-devel,libssl-devel || EXIT /b 1
@EXIT /b 0
) ELSE IF "%BE%"=="mingw-gcc" (
@ECHO ON
choco install -y --no-progress mingw || EXIT /b 1
choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=System' cmake || EXIT /b 1
@EXIT /b 0
) ELSE IF "%BE%"=="msvc" (
@ECHO ON
choco install -y --no-progress visualstudio2017community || EXIT /b 1
choco install -y --no-progress visualstudio2017-workload-vctools || EXIT /b 1
choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=System' cmake || EXIT /b 1
)
) ELSE IF "%1"=="deplibs" (
IF "%BE%"=="cygwin-gcc" (
ECHO Skipping on this platform
EXIT /b 0
)
IF NOT EXIST build_ci\libs (
MKDIR build_ci\libs
)
CD build_ci\libs
IF NOT EXIST zlib-%ZLIB_VERSION%.tar.gz (
curl -o zlib-%ZLIB_VERSION%.tar.gz https://www.zlib.net/zlib-%ZLIB_VERSION%.tar.gz
)
IF NOT EXIST zlib-%ZLIB_VERSION% (
tar -x -z -f zlib-%ZLIB_VERSION%.tar.gz
)
SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
CD zlib-%ZLIB_VERSION%
IF "%BE%"=="mingw-gcc" (
cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" . || EXIT /b 1
mingw32-make || EXIT /b 1
mingw32-make test || EXIT /b 1
mingw32-make install || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
cmake -G "Visual Studio 15 2017" . || EXIT /b 1
cmake --build . --target ALL_BUILD --config Release || EXIT /b 1
cmake --build . --target RUN_TESTS --config Release || EXIT /b 1
cmake --build . --target INSTALL --config Release || EXIT /b 1
)
) ELSE IF "%1%"=="configure" (
IF "%BE%"=="cygwin-gcc" (
SET BS=cmake
SET CONFIGURE_ARGS=-DENABLE_ACL=OFF
C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a configure" || EXIT /b 1
) ELSE IF "%BE%"=="mingw-gcc" (
SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
MKDIR build_ci\cmake
CD build_ci\cmake
cmake -G "MinGW Makefiles" ..\.. || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
MKDIR build_ci\cmake
CD build_ci\cmake
cmake -G "Visual Studio 15 2017" -D CMAKE_BUILD_TYPE="Release" ..\.. || EXIT /b 1
)
) ELSE IF "%1%"=="build" (
IF "%BE%"=="cygwin-gcc" (
SET BS=cmake
C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a build"
) ELSE IF "%BE%"=="mingw-gcc" (
SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
CD build_ci\cmake
mingw32-make || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
CD build_ci\cmake
cmake --build . --target ALL_BUILD --config Release
)
) ELSE IF "%1%"=="test" (
IF "%BE%"=="cygwin-gcc" (
ECHO "Skipping tests on this platform"
EXIT /b 0
REM SET BS=cmake
REM SET SKIP_TEST_SPARSE=1
REM C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a test"
) ELSE IF "%BE%"=="mingw-gcc" (
SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
COPY "C:\Program Files (x86)\zlib\bin\libzlib.dll" build_ci\cmake\bin\
CD build_ci\cmake
SET SKIP_TEST_SPARSE=1
mingw32-make test
) ELSE IF "%BE%"=="msvc" (
SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
ECHO "Skipping tests on this platform"
EXIT /b 0
REM CD build_ci\cmake
REM cmake --build . --target RUN_TESTS --config Release
)
) ELSE IF "%1%"=="install" (
IF "%BE%"=="cygwin-gcc" (
SET BS=cmake
C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a install"
) ELSE IF "%BE%"=="mingw-gcc" (
SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
CD build_ci\cmake
mingw32-make install DESTDIR=%cd%\destdir
) ELSE IF "%BE%"=="msvc" (
SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
cmake --build . --target INSTALL --config Release
)
) ELSE (
ECHO "Usage: %0% prepare|deplibs|configure|build|test|install"
@EXIT /b 0
)
@EXIT /b 0
-58
View File
@@ -1,58 +0,0 @@
#!/bin/sh
UNAME=`uname`
if [ "$1" = "prepare" ]
then
if [ "${UNAME}" = "FreeBSD" ]
then
set -x -e
env ASSUME_ALWAYS_YES=yes pkg bootstrap -f
sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf
pkg update
mount -u -o acls /
mkdir /tmp_acl_nfsv4
MD=`mdconfig -a -t swap -s 128M`
newfs /dev/$MD
tunefs -N enable /dev/$MD
mount /dev/$MD /tmp_acl_nfsv4
chmod 1777 /tmp_acl_nfsv4
pkg install -y autoconf automake cmake libiconv libtool pkgconf expat libxml2 liblz4 zstd
elif [ "${UNAME}" = "Darwin" ]
then
set -x -e
brew update > /dev/null
for pkg in autoconf automake libtool pkg-config cmake xz lz4 zstd
do
brew list $pkg > /dev/null && brew upgrade $pkg || brew install $pkg
done
elif [ "${UNAME}" = "Linux" ]
then
if [ -f "/etc/debian_version" ]
then
apt-get -y update
apt-get -y install build-essential locales automake libtool bison sharutils pkgconf libacl1-dev libbz2-dev zlib1g-dev liblzma-dev liblz4-dev libzstd-dev libssl-dev lrzip cmake
elif [ -f "/etc/fedora-release" ]
then
dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison sharutils pkgconf libacl-devel librichacl-devel bzip2-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel
fi
fi
elif [ "$1" = "test" ]
then
if [ "${UNAME}" = "FreeBSD" ]
then
set -e
echo "Additional NFSv4 ACL tests"
CURDIR=`pwd`
if [ "${BS}" = "cmake" ]
then
BIN_SUBDIR="bin"
else
BIN_SUBDIR=.
fi
BUILDDIR="${CURDIR}/build_ci/${BS}"
cd "$BUILDDIR"
TMPDIR=/tmp_acl_nfsv4 ${BIN_SUBDIR}/libarchive_test -r "${CURDIR}/libarchive/test" -v test_acl_platform_nfs4
fi
else
echo "Usage $0 prepare | test_nfsv4_acls"
exit 1
fi
+40 -110
View File
@@ -1,135 +1,46 @@
@ECHO OFF
SET ZLIB_VERSION=1.3
SET BZIP2_VERSION=1ea1ac188ad4b9cb662e3f8314673c63df95a589
SET XZ_VERSION=5.4.4
IF NOT "%BE%"=="mingw-gcc" (
IF NOT "%BE%"=="msvc" (
ECHO Environment variable BE must be mingw-gcc or msvc
EXIT /b 1
IF NOT "%BE%"=="cygwin-gcc" (
ECHO Environment variable BE must be cygwin-gcc, mingw-gcc or msvc
EXIT /b 1
)
)
)
REM v1.5.6 has a bug with the CMake files & MSVC
REM https://github.com/facebook/zstd/issues/3999
REM Fall back to 1.5.5 for MSVC until fixed
IF "%BE%"=="msvc" (
SET ZSTD_VERSION=1.5.5
) ELSE (
SET ZSTD_VERSION=1.5.6
)
SET ORIGPATH=%PATH%
IF "%BE%"=="mingw-gcc" (
SET MINGWPATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\cmake\bin;C:\ProgramData\mingw64\mingw64\bin
SET MINGWPATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\msys64\mingw64\bin;C:\Program Files\cmake\bin
)
IF "%1"=="deplibs" (
IF NOT EXIST build_ci\libs (
MKDIR build_ci\libs
)
CD build_ci\libs
IF NOT EXIST zlib-%ZLIB_VERSION%.zip (
ECHO Downloading https://github.com/libarchive/zlib/archive/v%ZLIB_VERSION%.zip
curl -L -o zlib-%ZLIB_VERSION%.zip https://github.com/libarchive/zlib/archive/v%ZLIB_VERSION%.zip || EXIT /b 1
)
IF NOT EXIST zlib-%ZLIB_VERSION% (
ECHO Unpacking zlib-%ZLIB_VERSION%.zip
C:\windows\system32\tar.exe -x -f zlib-%ZLIB_VERSION%.zip || EXIT /b 1
)
IF NOT EXIST bzip2-%BZIP2_VERSION%.zip (
echo Downloading https://github.com/libarchive/bzip2/archive/%BZIP2_VERSION%.zip
curl -L -o bzip2-%BZIP2_VERSION%.zip https://github.com/libarchive/bzip2/archive/%BZIP2_VERSION%.zip || EXIT /b 1
)
IF NOT EXIST bzip2-%BZIP2_VERSION% (
echo Unpacking bzip2-%BZIP2_VERSION%.zip
C:\windows\system32\tar.exe -x -f bzip2-%BZIP2_VERSION%.zip || EXIT /b 1
)
IF NOT EXIST xz-%XZ_VERSION%.zip (
echo Downloading https://github.com/libarchive/xz/archive/%XZ_VERSION%.zip
curl -L -o xz-%XZ_VERSION%.zip https://github.com/libarchive/xz/archive/v%XZ_VERSION%.zip || EXIT /b 1
)
IF NOT EXIST xz-%XZ_VERSION% (
echo Unpacking xz-%XZ_VERSION%.zip
C:\windows\system32\tar.exe -x -f xz-%XZ_VERSION%.zip || EXIT /b 1
)
IF NOT EXIST zstd-%ZSTD_VERSION%.zip (
echo Downloading https://github.com/facebook/zstd/archive/refs/tags/v%ZSTD_VERSION%.zip
curl -L -o zstd-%ZSTD_VERSION%.zip https://github.com/facebook/zstd/archive/refs/tags/v%ZSTD_VERSION%.zip || EXIT /b 1
)
IF NOT EXIST zstd-%ZSTD_VERSION% (
echo Unpacking zstd-%ZSTD_VERSION%.zip
C:\windows\system32\tar.exe -x -f zstd-%ZSTD_VERSION%.zip || EXIT /b 1
)
CD zlib-%ZLIB_VERSION%
IF "%BE%"=="mingw-gcc" (
SET PATH=%MINGWPATH%
cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" . || EXIT /b 1
mingw32-make || EXIT /b 1
mingw32-make test || EXIT /b 1
mingw32-make install || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
cmake -G "Visual Studio 17 2022" . || EXIT /b 1
cmake --build . --target ALL_BUILD --config Release || EXIT /b 1
cmake --build . --target RUN_TESTS --config Release || EXIT /b 1
cmake --build . --target INSTALL --config Release || EXIT /b 1
)
CD ..
CD bzip2-%BZIP2_VERSION%
IF "%BE%"=="mingw-gcc" (
SET PATH=%MINGWPATH%
cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" -D ENABLE_LIB_ONLY=ON -D ENABLE_SHARED_LIB=OFF -D ENABLE_STATIC_LIB=ON . || EXIT /b 1
mingw32-make || EXIT /b 1
REM mingw32-make test || EXIT /b 1
mingw32-make install || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
cmake -G "Visual Studio 17 2022" -D CMAKE_BUILD_TYPE="Release" -D ENABLE_LIB_ONLY=ON -D ENABLE_SHARED_LIB=OFF -D ENABLE_STATIC_LIB=ON . || EXIT /b 1
cmake --build . --target ALL_BUILD --config Release || EXIT /b 1
REM cmake --build . --target RUN_TESTS --config Release || EXIT /b 1
cmake --build . --target INSTALL --config Release || EXIT /b 1
)
CD ..
CD xz-%XZ_VERSION%
IF "%BE%"=="mingw-gcc" (
SET PATH=%MINGWPATH%
cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" . || EXIT /b 1
mingw32-make || EXIT /b 1
mingw32-make install || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
cmake -G "Visual Studio 17 2022" -D CMAKE_BUILD_TYPE="Release" . || EXIT /b 1
cmake --build . --target ALL_BUILD --config Release || EXIT /b 1
cmake --build . --target INSTALL --config Release || EXIT /b 1
)
CD ..
CD zstd-%ZSTD_VERSION%\build\cmake
IF "%BE%"=="mingw-gcc" (
SET PATH=%MINGWPATH%
cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" . || EXIT /b 1
mingw32-make || EXIT /b 1
mingw32-make install || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
cmake -G "Visual Studio 17 2022" -D CMAKE_BUILD_TYPE="Release" . || EXIT /b 1
cmake --build . --target ALL_BUILD --config Release || EXIT /b 1
cmake --build . --target INSTALL --config Release || EXIT /b 1
)
) ELSE IF "%1%"=="configure" (
IF "%1%"=="configure" (
IF "%BE%"=="mingw-gcc" (
SET PATH=%MINGWPATH%
MKDIR build_ci\cmake
CD build_ci\cmake
cmake -G "MinGW Makefiles" -D ZLIB_LIBRARY="C:/Program Files (x86)/zlib/lib/libzlibstatic.a" -D ZLIB_INCLUDE_DIR="C:/Program Files (x86)/zlib/include" -D BZIP2_LIBRARIES="C:/Program Files (x86)/bzip2/lib/libbz2_static.a" -D BZIP2_INCLUDE_DIR="C:/Program Files (x86)/bzip2/include" -D LIBLZMA_LIBRARY="C:/Program Files (x86)/xz/lib/liblzma.a" -D LIBLZMA_INCLUDE_DIR="C:/Program Files (x86)/xz/include" -D ZSTD_LIBRARY="C:/Program Files (x86)/zstd/lib/libzstd.a" -D ZSTD_INCLUDE_DIR="C:/Program Files (x86)/zstd/include" ..\.. || EXIT /b 1
cmake -G "MinGW Makefiles" ..\.. || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
MKDIR build_ci\cmake
CD build_ci\cmake
cmake -G "Visual Studio 17 2022" -D CMAKE_BUILD_TYPE="Release" -D ZLIB_LIBRARY="C:/Program Files (x86)/zlib/lib/zlibstatic.lib" -D ZLIB_INCLUDE_DIR="C:/Program Files (x86)/zlib/include" -D BZIP2_LIBRARIES="C:/Program Files (x86)/bzip2/lib/bz2_static.lib" -D BZIP2_INCLUDE_DIR="C:/Program Files (x86)/bzip2/include" -D LIBLZMA_LIBRARY="C:/Program Files (x86)/xz/lib/liblzma.lib" -D LIBLZMA_INCLUDE_DIR="C:/Program Files (x86)/xz/include" -D ZSTD_LIBRARY="C:/Program Files (x86)/zstd/lib/zstd_static.lib" -D ZSTD_INCLUDE_DIR="C:/Program Files (x86)/zstd/include" ..\.. || EXIT /b 1
cmake -G "Visual Studio 17 2022" -D CMAKE_BUILD_TYPE="Release" --toolchain "%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake" -D VCPKG_TARGET_TRIPLET=x64-windows-static -D VCPKG_MANIFEST_DIR=%GITHUB_WORKSPACE%\build\ci\github_actions ..\.. || EXIT /b 1
) ELSE IF "%BE%"=="cygwin-gcc" (
SET BS=cmake
SET CYGWIN_NOWINPATH=1
D:\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a configure" || EXIT /b 1
)
) ELSE IF "%1%"=="build" (
IF "%BE%"=="mingw-gcc" (
SET PATH=%MINGWPATH%
CD build_ci\cmake
mingw32-make VERBOSE=1 || EXIT /b 1
mingw32-make -j %NUMBER_OF_PROCESSORS% VERBOSE=1 || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
CD build_ci\cmake
cmake --build . --target ALL_BUILD --config Release || EXIT /b 1
) ELSE IF "%BE%"=="cygwin-gcc" (
SET BS=cmake
SET MAKE_ARGS=-j
SET CYGWIN_NOWINPATH=1
D:\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a build" || EXIT /b 1
)
) ELSE IF "%1%"=="test" (
IF "%BE%"=="mingw-gcc" (
@@ -138,10 +49,15 @@ IF "%1"=="deplibs" (
SET SKIP_TEST_SPARSE=1
mingw32-make test VERBOSE=1 || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
CD build_ci\cmake
cmake --build . --target RUN_TESTS --config Release || EXIT /b 1
) ELSE IF "%BE%"=="cygwin-gcc" (
REM SET BS=cmake
REM SET CYGWIN_NOWINPATH=1
REM SET SKIP_TEST_SPARSE=1
ECHO "Skipping tests on this platform"
REM D:\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a test" || EXIT /b 1
EXIT /b 0
REM CD build_ci\cmake
REM cmake --build . --target RUN_TESTS --config Release || EXIT /b 1
)
) ELSE IF "%1%"=="install" (
IF "%BE%"=="mingw-gcc" (
@@ -151,9 +67,23 @@ IF "%1"=="deplibs" (
) ELSE IF "%BE%"=="msvc" (
CD build_ci\cmake
cmake --build . --target INSTALL --config Release || EXIT /b 1
) ELSE IF "%BE%"=="cygwin-gcc" (
SET BS=cmake
SET CYGWIN_NOWINPATH=1
D:\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a install" || EXIT /b 1
REM Exit early here; the build.sh install step for Cygwin prints the version.
EXIT /b 0
)
"C:\Program Files (x86)\libarchive\bin\bsdtar.exe" --version
) ELSE IF "%1"=="artifact" (
C:\windows\system32\tar.exe -c -C "C:\Program Files (x86)" --format=zip -f libarchive.zip libarchive
IF "%BE%"=="cygwin-gcc" (
SET BS=cmake
SET CYGWIN_NOWINPATH=1
D:\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a artifact" || EXIT /b 1
EXIT /b 0
)
C:\windows\system32\tar.exe -c -C "C:\Program Files (x86)" --format=zip -f libarchive.zip libarchive
) ELSE (
ECHO "Usage: %0% deplibs|configure|build|test|install|artifact"
@EXIT /b 0
+41
View File
@@ -0,0 +1,41 @@
#!/bin/sh
set -eu
if [ $# != 1 ]
then
echo "Usage: $0 prepare | test"
exit 1
fi
if [ "$1" = "prepare" ]
then
set -x -e
env ASSUME_ALWAYS_YES=yes pkg bootstrap -f
sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf
pkg update
mount -u -o acls /
mkdir /tmp_acl_nfsv4
MD=`mdconfig -a -t swap -s 128M`
newfs /dev/$MD
tunefs -N enable /dev/$MD
mount /dev/$MD /tmp_acl_nfsv4
chmod 1777 /tmp_acl_nfsv4
pkg install -y autoconf automake cmake gmake libiconv libtool pkgconf expat libxml2 liblz4 zstd
elif [ "$1" = "test" ]
then
set -e
echo "Additional NFSv4 ACL tests"
CURDIR=`pwd`
if [ "${BS}" = "cmake" ]
then
BIN_SUBDIR="bin"
else
BIN_SUBDIR=.
fi
BUILDDIR="${CURDIR}/build_ci/${BS}"
cd "$BUILDDIR"
TMPDIR=/tmp_acl_nfsv4 ${BIN_SUBDIR}/libarchive_test -r "${CURDIR}/libarchive/test" -v test_acl_platform_nfs4
else
echo "Usage: $0 prepare | test"
exit 1
fi
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
set -eux
# Uncommenting these adds a full minute to the CI time
#brew update > /dev/null
#brew upgrade > /dev/null
# Workaround for cmake in local/pinned tap issue
brew uninstall cmake
# This does an upgrade if the package is already installed
brew install \
autoconf \
automake \
libtool \
pkg-config \
cmake \
xz \
lz4 \
zstd \
libxml2 \
openssl
-21
View File
@@ -1,21 +0,0 @@
#!/bin/sh
if [ "$1" = "prepare" ]
then
set -x -e
#Uncommenting these adds a full minute to the CI time
#brew update > /dev/null
#brew upgrade > /dev/null
# This does an upgrade if the package is already installed
brew install \
autoconf \
automake \
libtool \
pkg-config \
cmake \
xz \
lz4 \
zstd \
libxml2 \
openssl
fi
+15
View File
@@ -0,0 +1,15 @@
{
"dependencies": [
"zlib",
"bzip2",
"liblzma",
"zstd"
],
"vcpkg-configuration": {
"default-registry": {
"kind": "git",
"repository": "https://github.com/microsoft/vcpkg",
"baseline": "44819aa2a6c10e56065e2b0330e7d6c89d1d2574"
}
}
}
-33
View File
@@ -1,33 +0,0 @@
#!/bin/sh
set -e
UNAME=`uname`
CURDIR=`pwd`
SRCDIR="${SRCDIR:-`pwd`}"
if [ -z "${BUILDDIR}" ]; then
BUILDDIR="${CURDIR}/build_ci/${BS}"
fi
mkdir -p "${BUILDDIR}"
cd "${BUILDDIR}"
case "$UNAME" in
MSYS*)
if [ "${BS}" = "msbuild" ]; then
set -x
cmake -G "Visual Studio 15 2017" -D CMAKE_BUILD_TYPE="Release" "${SRCDIR}"
cmake --build . --target ALL_BUILD
# Until fixed, we don't run tests on Windows (lots of fails + timeout)
#export SKIP_TEST_FUZZ=1
#cmake --build . --target RUN_TESTS
set +x
elif [ "${BS}" = "mingw" ]; then
set -x
cmake -G "MSYS Makefiles" -D CMAKE_C_COMPILER="${CC}" -D CMAKE_MAKE_PROGRAM="mingw32-make" -D CMAKE_BUILD_TYPE="Release" "${SRCDIR}"
mingw32-make
#export SKIP_TEST_FUZZ=1
#mingw32-make test
set +x
else
echo "Unknown or unspecified build type: ${BS}"
exit 1
fi
;;
esac
+1
View File
@@ -1,4 +1,5 @@
#!/bin/sh
set -eu
#
# Attempt to remove as many generated files as we can.
+1 -1
View File
@@ -29,5 +29,5 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/pkgconfig/libarchive.pc.in
# And install it, of course ;).
IF(ENABLE_INSTALL)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/build/pkgconfig/libarchive.pc
DESTINATION "lib/pkgconfig")
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
ENDIF()
+3 -3
View File
@@ -19,13 +19,13 @@
# xdg-open coverage/index.html
#################################################################
# Find programs we need
# Find programs we need
FIND_PROGRAM(LCOV_EXECUTABLE lcov DOC "Full path to lcov executable")
FIND_PROGRAM(GENHTML_EXECUTABLE genhtml DOC "Full path to genhtml executable")
MARK_AS_ADVANCED(LCOV_EXECUTABLE GENHTML_EXECUTABLE)
# Check, compiler, build types and programs are available
IF(NOT CMAKE_COMPILER_IS_GNUCC)
IF(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU")
MESSAGE(FATAL_ERROR "Coverage can only be built on GCC")
ELSEIF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE(FATAL_ERROR "Coverage can only be built in Debug mode")
@@ -33,7 +33,7 @@ ELSEIF(NOT LCOV_EXECUTABLE)
MESSAGE(FATAL_ERROR "lcov executable not found")
ELSEIF(NOT GENHTML_EXECUTABLE)
MESSAGE(FATAL_ERROR "genhtml executable not found")
ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
ENDIF()
# Enable testing if not already done
SET(ENABLE_TEST ON)
+57 -10
View File
@@ -405,6 +405,12 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the `chroot' function. */
#cmakedefine HAVE_CHROOT 1
/* Define to 1 if you have the `closefrom' function. */
#cmakedefine HAVE_CLOSEFROM 1
/* Define to 1 if you have the `close_range' function. */
#cmakedefine HAVE_CLOSE_RANGE 1
/* Define to 1 if you have the <copyfile.h> header file. */
#cmakedefine HAVE_COPYFILE_H 1
@@ -636,6 +642,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the `getea' function. */
#cmakedefine HAVE_GETEA 1
/* Define to 1 if you have the `getegid' function. */
#cmakedefine HAVE_GETEGID 1
/* Define to 1 if you have the `geteuid' function. */
#cmakedefine HAVE_GETEUID 1
@@ -657,6 +666,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the `getpwuid_r' function. */
#cmakedefine HAVE_GETPWUID_R 1
/* Define to 1 if you have the `gettimeofday' function. */
#cmakedefine HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the `getvfsbyname' function. */
#cmakedefine HAVE_GETVFSBYNAME 1
@@ -675,6 +687,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <iconv.h> header file. */
#cmakedefine HAVE_ICONV_H 1
/* Define to 1 if you have the <intsafe.h> header file. */
#cmakedefine HAVE_INTSAFE_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
@@ -729,15 +744,15 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the `gcc' library (-lgcc). */
#cmakedefine HAVE_LIBGCC 1
/* Define to 1 if you have the `iconv' library (-liconv). */
#cmakedefine HAVE_LIBICONV 1
/* Define to 1 if you have the `lz4' library (-llz4). */
#cmakedefine HAVE_LIBLZ4 1
/* Define to 1 if you have the `lzma' library (-llzma). */
#cmakedefine HAVE_LIBLZMA 1
/* Define to 1 if you have the `lzmadec' library (-llzmadec). */
#cmakedefine HAVE_LIBLZMADEC 1
/* Define to 1 if you have the `lzo2' library (-llzo2). */
#cmakedefine HAVE_LIBLZO2 1
@@ -768,6 +783,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <libxml/xmlwriter.h> header file. */
#cmakedefine HAVE_LIBXML_XMLWRITER_H 1
/* Define to 1 if you have the <libxml/xmlversion.h> header file. */
#cmakedefine HAVE_LIBXML_XMLVERSION_H 1
/* Define to 1 if you have the `z' library (-lz). */
#cmakedefine HAVE_LIBZ 1
@@ -777,6 +795,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the ZSTD_compressStream function. */
#cmakedefine HAVE_ZSTD_compressStream 1
/* Define to 1 if you have the ZSTD_minCLevel function. */
#cmakedefine HAVE_ZSTD_minCLevel 1
/* Define to 1 if you have the <limits.h> header file. */
#cmakedefine HAVE_LIMITS_H 1
@@ -847,9 +868,6 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <lz4.h> header file. */
#cmakedefine HAVE_LZ4_H 1
/* Define to 1 if you have the <lzmadec.h> header file. */
#cmakedefine HAVE_LZMADEC_H 1
/* Define to 1 if you have the <lzma.h> header file. */
#cmakedefine HAVE_LZMA_H 1
@@ -871,6 +889,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <mbedtls/pkcs5.h> header file. */
#cmakedefine HAVE_MBEDTLS_PKCS5_H 1
/* Define to 1 if you have the <mbedtls/pkcs5.h> header file. */
#cmakedefine HAVE_MBEDTLS_VERSION_H 1
/* Define to 1 if you have the `mbrtowc' function. */
#cmakedefine HAVE_MBRTOWC 1
@@ -916,6 +937,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <nettle/sha.h> header file. */
#cmakedefine HAVE_NETTLE_SHA_H 1
/* Define to 1 if you have the <nettle/version.h> header file. */
#cmakedefine HAVE_NETTLE_VERSION_H 1
/* Define to 1 if you have the `nl_langinfo' function. */
#cmakedefine HAVE_NL_LANGINFO 1
@@ -925,6 +949,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <openssl/evp.h> header file. */
#cmakedefine HAVE_OPENSSL_EVP_H 1
/* Define to 1 if you have the <openssl/opensslv.h> header file. */
#cmakedefine HAVE_OPENSSL_OPENSSLV_H 1
/* Define to 1 if you have the <paths.h> header file. */
#cmakedefine HAVE_PATHS_H 1
@@ -958,9 +985,6 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <pwd.h> header file. */
#cmakedefine HAVE_PWD_H 1
/* Define to 1 if you have the `readdir_r' function. */
#cmakedefine HAVE_READDIR_R 1
/* Define to 1 if you have the `readlink' function. */
#cmakedefine HAVE_READLINK 1
@@ -1007,9 +1031,15 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <stdarg.h> header file. */
#cmakedefine HAVE_STDARG_H 1
/* Define to 1 if you have the <stdckdint.h> header file. */
#cmakedefine HAVE_STDCKDINT_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#cmakedefine HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1
@@ -1147,7 +1177,6 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysmacros.h> header file. */
#cmakedefine HAVE_SYS_SYSMACROS_H 1
@@ -1172,6 +1201,12 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <sys/xattr.h> header file. */
#cmakedefine HAVE_SYS_XATTR_H 1
/* Define to 1 if you have the `tcgetattr' function. */
#cmakedefine HAVE_TCGETATTR 1
/* Define to 1 if you have the `tcsetattr' function. */
#cmakedefine HAVE_TCSETATTR 1
/* Define to 1 if you have the `timegm' function. */
#cmakedefine HAVE_TIMEGM 1
@@ -1265,6 +1300,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have a working FS_IOC_GETFLAGS */
#cmakedefine HAVE_WORKING_FS_IOC_GETFLAGS 1
/* Define to 1 if you have the Windows `xmllite' library (-lxmllite). */
#cmakedefine HAVE_XMLLITE_H 1
/* Define to 1 if you have the <zlib.h> header file. */
#cmakedefine HAVE_ZLIB_H 1
@@ -1322,6 +1360,15 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#cmakedefine TIME_WITH_SYS_TIME 1
/* Version number of package */
#cmakedefine LIBATTR_PKGCONFIG_VERSION "@LIBATTR_PKGCONFIG_VERSION@"
/* Version number of package */
#cmakedefine LIBACL_PKGCONFIG_VERSION "@LIBACL_PKGCONFIG_VERSION@"
/* Version number of package */
#cmakedefine LIBRICHACL_PKGCONFIG_VERSION "@LIBRICHACL_PKGCONFIG_VERSION@"
/*
* Some platform requires a macro to use extension functions.
*/
+13
View File
@@ -0,0 +1,13 @@
# Generated by CMake at configure time -- do not edit.
# Scans test source files for DEFINE_TEST() declarations and writes list.h.
set(_sources @SOURCES@)
set(_output "@OUTPUT@")
file(WRITE "${_output}" "")
foreach(_src ${_sources})
if(_src MATCHES "test_[^/]+\\.c$")
file(STRINGS "${_src}" _lines REGEX "^DEFINE_TEST")
foreach(_line ${_lines})
file(APPEND "${_output}" "${_line}\n")
endforeach()
endif()
endforeach()
+46
View File
@@ -0,0 +1,46 @@
---
BasedOnStyle: Google
AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: Left
AlignConsecutiveAssignments:
AlignFunctionDeclarations: true
AlignConsecutiveMacros:
Enabled: true
AlignOperands: DontAlign
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: false
BinPackParameters: OnePerLine
BreakBeforeTemplateCloser: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterComma
BreakStringLiterals: false
ColumnLimit: 120
ConstructorInitializerIndentWidth: 8
EnumTrailingComma: Insert
IncludeBlocks: Preserve
IndentCaseLabels: false
IndentGotoLabels: false
IndentPPDirectives: AfterHash
IndentWidth: 8
PPIndentWidth: 1
PackConstructorInitializers: BinPack
PointerAlignment: Right
QualifierAlignment: Left
RemoveEmptyLinesInUnwrappedLines: true
SeparateDefinitionBlocks: Always
SortIncludes:
Enabled: false
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: false
AfterForeachMacros: false
AfterIfMacros: false
SpacesInContainerLiterals: false
UseTab: ForIndentation
+25
View File
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.12)
set(CMAKE_CXX_STANDARD 23)
project(libarchive-clang-tools)
find_package(zstd REQUIRED)
find_package(Clang REQUIRED)
add_executable(la-lint)
target_sources(la-lint
PRIVATE
main.cpp
)
target_include_directories(la-lint
PRIVATE
${CLANG_INCLUDE_DIRS}
)
target_link_libraries(la-lint
PRIVATE
LLVM LLVMCore LLVMSupport
libclang clang-cpp
)
install(TARGETS la-lint RUNTIME DESTINATION bin)
+190
View File
@@ -0,0 +1,190 @@
/*-
* Copyright (c) 2026 Dustin L. Howett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <clang/Frontend/FrontendActions.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>
#include <clang/Frontend/ChainedDiagnosticConsumer.h>
#include <clang/Tooling/CommonOptionsParser.h>
#include <clang/Tooling/Tooling.h>
#include <clang/ASTMatchers/ASTMatchFinder.h>
#include <llvm/Support/CommandLine.h>
#include <print>
using namespace clang::tooling;
using namespace clang::ast_matchers;
using namespace llvm;
static llvm::cl::OptionCategory LaToolCategory("la-clang-tool options");
static llvm::cl::opt<std::string> Prefix("prefix",
llvm::cl::desc("Project path prefix"),
llvm::cl::init(""),
llvm::cl::cat(LaToolCategory));
static bool IsGithubCiBuild{};
struct MemCmpNeedleHandler : public MatchFinder::MatchCallback {
virtual void run(const MatchFinder::MatchResult &result) {
auto needle = result.Nodes.getNodeAs<clang::StringLiteral>("needle");
auto lenExpr = result.Nodes.getNodeAs<clang::IntegerLiteral>("length");
/*
* This check uses [less than] rather than [less equal] because in some formats we want to verify the
* presence of the null terminator and in others we do not.
*/
if(lenExpr->getValue().ult(needle->getLength())) {
auto &diag = result.Context->getDiagnostics();
auto did = diag.getCustomDiagID(clang::DiagnosticsEngine::Level::Error,
"memcmp needle has length `%0', but is checked with length `%1'");
clang::DiagnosticBuilder db = diag.Report(lenExpr->getLocation(), did);
db.AddTaggedVal(needle->getLength(), clang::DiagnosticsEngine::ArgumentKind::ak_uint);
db.AddTaggedVal(lenExpr->getValue().getSExtValue(),
clang::DiagnosticsEngine::ArgumentKind::ak_sint);
db.AddSourceRange(clang::CharSourceRange::getCharRange(needle->getSourceRange()));
}
}
};
struct AssertUAFHandler : public MatchFinder::MatchCallback {
virtual void run(const MatchFinder::MatchResult &result) {
/*
* This code uses getFileLoc to specify locations disregarding macro expansion
* and to avoid Clang printing "macro expanded from here".
*/
auto &SM = *result.SourceManager;
auto uaf = result.Nodes.getNodeAs<clang::DeclRefExpr>("uaf");
auto assertion = result.Nodes.getNodeAs<clang::CallExpr>("assertion");
auto freed = result.Nodes.getNodeAs<clang::CallExpr>("free");
auto &diag = result.Context->getDiagnostics();
{
auto did = diag.getCustomDiagID(clang::DiagnosticsEngine::Level::Error,
"test assertion uses `%0' after free; prefer assertEqualInt");
clang::DiagnosticBuilder db = diag.Report(SM.getFileLoc(uaf->getBeginLoc()), did);
db.AddString(uaf->getNameInfo().getAsString());
db << clang::FixItHint::CreateReplacement(
clang::SourceRange{SM.getFileLoc(assertion->getBeginLoc()),
SM.getFileLoc(uaf->getBeginLoc())},
"assertEqualInt(");
}
{
auto did = diag.getCustomDiagID(clang::DiagnosticsEngine::Level::Note, "`%0' freed here");
clang::DiagnosticBuilder db = diag.Report(freed->getBeginLoc(), did);
db.AddString(uaf->getNameInfo().getAsString());
}
}
};
class GithubActionDiagnosticConsumer : public clang::DiagnosticConsumer {
virtual void HandleDiagnostic(clang::DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic &Info) {
static constexpr const char *levels[] = {nullptr, "notice", "notice", "warning", "error", "error"};
const auto level = levels[DiagLevel];
if(!level)
return;
auto &SM = Info.getSourceManager();
auto loc = Info.getLocation();
loc = SM.getFileLoc(loc);
auto file = SM.getFilename(loc);
if(file.empty()) {
return;
}
file.consume_front_insensitive(Prefix);
while(file.consume_front("/")) {}
bool lineInvalid = false;
auto line = SM.getLineNumber(loc, &lineInvalid);
if(lineInvalid) {
return;
}
llvm::SmallVector<char> diagString;
Info.FormatDiagnostic(diagString);
std::print("::{0} file={1},line={2},title=Lint::{3}\n", level, std::string_view{file}, line,
std::string_view{diagString});
}
};
int main(int argc, const char **argv) {
auto exp = CommonOptionsParser::create(argc, argv, LaToolCategory);
auto &optionsParser = exp.get();
ClangTool tool(optionsParser.getCompilations(), optionsParser.getSourcePathList());
if(const char *e = getenv("GITHUB_WORKSPACE")) {
IsGithubCiBuild = true;
if(Prefix.c_str()[0] == '\0') {
Prefix.assign(e);
Prefix.append("/");
}
}
MatchFinder finder;
/*
* Find every assertion_equal_mem that passes a string literal.
* --> assertEqualMem(foo, "literal", 7);
*/
MemCmpNeedleHandler memCmpHandler;
finder.addMatcher(callExpr(callee(functionDecl(hasName("assertion_equal_mem"))),
hasArgument(4, stringLiteral().bind("needle")),
hasArgument(6, integerLiteral(anything()).bind("length"))),
&memCmpHandler);
/*
* Find every assertion_equal_int whose call site contains a `free` function,
* and then passes the freed decl to assertion_equal_int as context.
* --> assertEqualIntA(a, ARCHIVE_OK, archive_write_free(a));
* ^-- must be the same as ----------^
*/
AssertUAFHandler uafHandler;
finder.addMatcher(
callExpr(callee(functionDecl(hasName("assertion_equal_int"))),
hasArgument(4,
callExpr(callee(functionDecl(matchesName("archive.*_free$"))),
hasArgument(0, declRefExpr(to(varDecl(anything()).bind("freed")))))
.bind("free")),
hasArgument(6, declRefExpr(to(varDecl(declaresSameEntityAsBoundNode("freed")))).bind("uaf")))
.bind("assertion"),
&uafHandler);
std::unique_ptr<clang::DiagnosticConsumer> diagnosticConsumer;
if(IsGithubCiBuild) {
/* Emit GitHub-formatted error messages by default when we are building in GitHub Actions */
clang::DiagnosticOptions diagOptions;
diagOptions.ShowColors = true;
clang::TextDiagnosticPrinter defaultDiag(llvm::errs(), diagOptions, false);
diagnosticConsumer = std::make_unique<clang::ChainedDiagnosticConsumer>(&defaultDiag,
std::make_unique<GithubActionDiagnosticConsumer>());
tool.setDiagnosticConsumer(diagnosticConsumer.get());
}
return tool.run(newFrontendActionFactory(&finder).get());
}
+4 -4
View File
@@ -1,4 +1,5 @@
#!/bin/sh
set -eu
#
# This script exists primarily to document some of the
@@ -8,7 +9,6 @@
#
PATH=/usr/local/gnu-autotools/bin/:$PATH
export PATH
# Start from one level above the build directory
if [ -f version ]; then
@@ -24,7 +24,7 @@ fi
# Makefile. Effectively disable it.
export MAKEOBJDIRPREFIX=/junk
set -ex
set -x
#
# Scrub the local tree before running the build tests below.
@@ -50,8 +50,8 @@ export MAKE_LIBARCHIVE_RELEASE="1"
/bin/sh build/autogen.sh
# Get the newest config.guess/config.sub from savannah.gnu.org
curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' > build/autoconf/config.guess
curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' > build/autoconf/config.sub
curl -fsSL 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' > build/autoconf/config.guess
curl -fsSL 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' > build/autoconf/config.sub
./configure
make distcheck
+2 -2
View File
@@ -3,8 +3,8 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
RUN apt-get update && apt-get install -y build-essential autoconf automake libtool pkg-config cmake zlib1g-dev libssl-dev libacl1-dev libbz2-dev liblzma-dev liblz4-dev libzstd-dev lzop groff ghostscript bsdmainutils zip
ADD . $HOME/libarchive/
ADD "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" $HOME/libarchive/build/autoconf/config.guess
ADD "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" $HOME/libarchive/build/autoconf/config.sub
ADD "https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" $HOME/libarchive/build/autoconf/config.guess
ADD "https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" $HOME/libarchive/build/autoconf/config.sub
WORKDIR $HOME/libarchive
RUN /bin/sh build/clean.sh
RUN /bin/sh build/autogen.sh
+3 -1
View File
@@ -1,8 +1,10 @@
#!/bin/sh
set -eu
ID=$(docker build -q -f build/release/Dockerfile .)
if [ -z "$ID" ]; then
echo "Failed to build docker image"
exit 1
else
docker run $ID sh -c "tar -c -f - libarchive-*" | tar -x -f -
docker run "$ID" sh -c "tar -c -f - libarchive-*" | tar -x -f -
fi
@@ -1,4 +1,12 @@
#!/bin/sh
set -eu
if [ $# != 1 ]
then
echo "Usage: $0 path/to/UnicodeData.txt"
exit 1
fi
#
# This needs http://unicode.org/Public/6.0.0/ucd/UnicodeData.txt
#
+1 -1
View File
@@ -1 +1 @@
3007005
3008009
+9 -4
View File
@@ -1,3 +1,6 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
############################################
#
# How to build bsdcat
@@ -10,8 +13,8 @@ IF(ENABLE_CAT)
bsdcat.h
bsdcat_platform.h
cmdline.c
../libarchive_fe/err.c
../libarchive_fe/err.h
../libarchive_fe/lafe_err.c
../libarchive_fe/lafe_err.h
../libarchive_fe/lafe_platform.h
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe)
@@ -30,8 +33,10 @@ IF(ENABLE_CAT)
ENDIF(ENABLE_CAT_SHARED)
# Installation rules
INSTALL(TARGETS bsdcat RUNTIME DESTINATION bin)
INSTALL_MAN(${bsdcat_MANS})
IF(ENABLE_INSTALL)
INSTALL(TARGETS bsdcat RUNTIME DESTINATION bin)
INSTALL_MAN(${bsdcat_MANS})
ENDIF(ENABLE_INSTALL)
ENDIF(ENABLE_CAT)
add_subdirectory(test)
+3 -21
View File
@@ -1,27 +1,9 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2011-2014, Mike Kazantsev
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd March 1, 2014
.Dt BSDCAT 1
.Os
+16 -21
View File
@@ -1,30 +1,15 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2011-2014, Mike Kazantsev
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "bsdcat_platform.h"
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -40,7 +25,7 @@
#include <archive_entry.h>
#include "bsdcat.h"
#include "err.h"
#include "lafe_err.h"
#define BYTES_PER_BLOCK (20*512)
@@ -123,6 +108,16 @@ main(int argc, char **argv)
bsdcat = &bsdcat_storage;
memset(bsdcat, 0, sizeof(*bsdcat));
#if defined(HAVE_SIGACTION) && defined(SIGCHLD)
{ /* Do not ignore SIGCHLD. */
struct sigaction sa;
sa.sa_handler = SIG_DFL;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(SIGCHLD, &sa, NULL);
}
#endif
lafe_setprogname(*argv, "bsdcat");
bsdcat->argv = argv;
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014, Mike Kazantsev
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BSDCAT_H_INCLUDED
+3 -21
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -58,7 +40,7 @@
#define __LA_NORETURN __attribute__((__noreturn__))
#elif defined(_MSC_VER)
#define __LA_NORETURN __declspec(noreturn)
#else
#else
#define __LA_NORETURN
#endif
+3 -21
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003-2008 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -40,7 +22,7 @@
#endif
#include "bsdcat.h"
#include "err.h"
#include "lafe_err.h"
/*
* Short options for bsdcat. Please keep this sorted.
+6 -14
View File
@@ -1,6 +1,9 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
############################################
#
# How to build bsdtar_test
# How to build bsdcat_test
#
############################################
IF(ENABLE_CAT AND ENABLE_TEST)
@@ -48,23 +51,12 @@ IF(ENABLE_CAT AND ENABLE_TEST)
# Generate list.h by grepping DEFINE_TEST() lines out of the C sources.
#
GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h
${CMAKE_CURRENT_LIST_FILE} ${bsdcat_test_SOURCES})
${CMAKE_CURRENT_LIST_FILE} bsdcat_test ${bsdcat_test_SOURCES})
SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
${CMAKE_CURRENT_BINARY_DIR})
# list.h has a line DEFINE_TEST(testname) for every
# test. We can use that to define the tests for cmake by
# defining a DEFINE_TEST macro and reading list.h in.
MACRO (DEFINE_TEST _testname)
ADD_TEST(
NAME bsdcat_${_testname}
COMMAND bsdcat_test -vv
-p $<TARGET_FILE:bsdcat>
-r ${CMAKE_CURRENT_SOURCE_DIR}
${_testname})
ENDMACRO (DEFINE_TEST _testname)
DISCOVER_TESTS(bsdcat ${bsdcat_test_SOURCES})
INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/test_utils)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/cat/test)
+2 -20
View File
@@ -1,26 +1,8 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003-2006 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Every test program should #include "test.h" as the first thing. */
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Sebastian Freundt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Sebastian Freundt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Sebastian Freundt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2017 Sean Purcell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Mike Kazantsev
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Mike Kazantsev
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Mike Kazantsev
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,27 +1,9 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Mike Kazantsev
* Copyright (c) 2012 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,27 +1,9 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Mike Kazantsev
* Copyright (c) 2012 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,27 +1,9 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Mike Kazantsev
* Copyright (c) 2012, 2014 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Mike Kazantsev
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Mike Kazantsev
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,27 +1,9 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Mike Kazantsev
* Copyright (c) 2012 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2017 Sean Purcell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2017 Sean Purcell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+2 -20
View File
@@ -1,26 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003-2017 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
+86 -84
View File
@@ -4,8 +4,8 @@ dnl First, define all of the version numbers up front.
dnl In particular, this allows the version macro to be used in AC_INIT
dnl These first two version numbers are updated automatically on each release.
m4_define([LIBARCHIVE_VERSION_S],[3.7.5])
m4_define([LIBARCHIVE_VERSION_N],[3007005])
m4_define([LIBARCHIVE_VERSION_S],[3.8.9])
m4_define([LIBARCHIVE_VERSION_N],[3008009])
dnl bsdtar and bsdcpio versioning tracks libarchive
m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
@@ -38,7 +38,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 ))
# Libarchive 2.7 == libtool interface 9 = 2 + 7
# Libarchive 2.8 == libtool interface 10 = 2 + 8
# Libarchive 2.9 == libtool interface 11 = 2 + 8
# Libarchive 2.9 == libtool interface 11 = 2 + 9
# Libarchive 3.0 == libtool interface 12
# Libarchive 3.1 == libtool interface 13
ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))`
@@ -101,6 +101,9 @@ esac
AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes])
AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes])
dnl On native Windows (MinGW), embedding the manifest needs windres
AS_IF([test $inc_windows_files = yes], [AC_CHECK_TOOL([WINDRES], [windres])])
dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc)
PLATFORMCPPFLAGS=
case "$host_os" in
@@ -108,6 +111,11 @@ case "$host_os" in
esac
AC_SUBST(PLATFORMCPPFLAGS)
dnl Linking on Haiku needs libbsd because of readpassphrase
case "$host_os" in
haiku*) LIBS="-lbsd $LIBS" ;;
esac
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
@@ -253,7 +261,8 @@ AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ])
case $host in
*mingw* | *cygwin* | *msys* )
AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
[[#ifdef _WIN32_WINNT
[[#include <windows.h>
#ifdef _WIN32_WINNT
# error _WIN32_WINNT already defined
#endif
]],[[;]])
@@ -262,7 +271,8 @@ case $host in
AC_DEFINE([NTDDI_VERSION], 0x05020000, [Define to '0x05020000' for Windows Server 2003 APIs.])
])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
[[#ifdef WINVER
[[#include <windows.h>
#ifdef WINVER
# error WINVER already defined
#endif
]],[[;]])
@@ -358,18 +368,19 @@ AS_VAR_IF([ac_cv_have_decl_FS_IOC_GETFLAGS], [yes],
[AC_DEFINE_UNQUOTED([HAVE_WORKING_FS_IOC_GETFLAGS], [1],
[Define to 1 if you have a working FS_IOC_GETFLAGS])])
AC_CHECK_HEADERS([locale.h membership.h paths.h poll.h pthread.h pwd.h])
AC_CHECK_HEADERS([readpassphrase.h signal.h spawn.h])
AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h])
AC_CHECK_HEADERS([intsafe.h locale.h membership.h paths.h poll.h pthread.h])
AC_CHECK_HEADERS([pwd.h readpassphrase.h signal.h spawn.h])
AC_CHECK_HEADERS([stdarg.h stdckdint.h stdint.h stdlib.h string.h])
AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/ea.h sys/extattr.h])
AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h])
AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/richacl.h])
AC_CHECK_HEADERS([sys/select.h sys/statfs.h sys/statvfs.h sys/sysmacros.h])
AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h sys/xattr.h])
AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h])
AC_CHECK_TYPE([suseconds_t])
AC_CHECK_HEADERS([windows.h])
# check windows.h first; the other headers require it.
AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[],
AC_CHECK_HEADERS([winioctl.h],[],[],
[[#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
@@ -393,6 +404,7 @@ if test "x$with_zlib" != "xno"; then
int main(int argc, char **argv) { inflate(NULL, 0); return 0; }
]])],
[AC_DEFINE([HAVE_ZLIB_H], [1], [Define to 1 if you have zlib >= 1.2.1])
AC_DEFINE([HAVE_LIBZ], [1], [Define to 1 if you have zlib >= 1.2.1])
AC_MSG_RESULT([found a suitable version of zlib (>= 1.2.1)])
],
[AC_MSG_RESULT([could not find a suitable version of zlib (>= 1.2.1)])
@@ -429,12 +441,18 @@ if test "x$with_bz2lib" != "xno"; then
esac
fi
PKG_PROG_PKG_CONFIG
AC_ARG_WITH([libb2],
AS_HELP_STRING([--without-libb2], [Don't build support for BLAKE2 through libb2]))
if test "x$with_libb2" != "xno"; then
AC_CHECK_HEADERS([blake2.h])
AC_CHECK_LIB(b2,blake2sp_init)
BLAKE2_PC_VER=`$PKG_CONFIG --modversion libb2`
if test "x$BLAKE2_PC_VER" != "x"; then
AC_DEFINE_UNQUOTED([LIBB2_PKGCONFIG_VERSION], ["$BLAKE2_PC_VER"], [Libb2 version coming from pkg-config.])
fi
fi
AM_CONDITIONAL([INC_BLAKE2], [test "x$ac_cv_lib_b2_blake2sp_init" != "xyes"])
@@ -447,13 +465,17 @@ if test "x$with_iconv" != "xno"; then
AC_CHECK_HEADERS([iconv.h],[],[],[#include <stdlib.h>])
if test "x$am_cv_func_iconv" = "xyes"; then
AC_CHECK_HEADERS([localcharset.h])
am_save_LIBS="$LIBS"
LIBS="${LIBS} ${LIBICONV}"
if test -n "$LIBICONV"; then
LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }iconv"
AC_DEFINE([HAVE_LIBICONV], [1], [Define to 1 if you have the `iconv' library (-liconv).])
# Most platforms do not provide iconv.pc, but MSYS2 MinGW does.
# We add it to our Requires.private only if it exists.
PKG_CHECK_MODULES(ICONV_PC, [iconv], [
LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }iconv"
], [true])
fi
AC_CHECK_FUNCS([locale_charset])
LIBS="${am_save_LIBS}"
if test "x$ac_cv_func_locale_charset" != "xyes"; then
# If locale_charset() is not in libiconv, we have to find libcharset.
AC_CHECK_LIB(charset,locale_charset)
@@ -477,14 +499,24 @@ if test "x$with_zstd" != "xno"; then
AC_CHECK_LIB(zstd,ZSTD_decompressStream)
AC_CHECK_LIB(zstd,ZSTD_compressStream,
AC_DEFINE([HAVE_ZSTD_compressStream], [1], [Define to 1 if you have the `zstd' library (-lzstd) with compression support.]))
AC_CHECK_LIB(zstd,ZSTD_minCLevel,
AC_DEFINE([HAVE_ZSTD_minCLevel], [1], [Define to 1 if you have a `zstd' library version with ZSTD_minCLevel().]))
fi
AC_ARG_WITH([lzma],
AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma]))
if test "x$with_lzma" != "xno"; then
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES(LZMA_PC, [liblzma], [
CPPFLAGS="${CPPFLAGS} ${LZMA_PC_CFLAGS}"
LIBS="${LIBS} ${LZMA_PC_LIBS}"
AC_DEFINE(HAVE_LIBLZMA, [1], [Define to 1 if you have the `lzma' library.])
], [
AC_CHECK_LIB(lzma,lzma_stream_decoder)
])
AC_CHECK_HEADERS([lzma.h])
AC_CHECK_LIB(lzma,lzma_stream_decoder)
# Some pre-release (but widely distributed) versions of liblzma
# included a disabled version of lzma_stream_encoder_mt that
# fools a naive AC_CHECK_LIB or AC_CHECK_FUNC, so we need
@@ -502,19 +534,6 @@ if test "x$with_lzma" != "xno"; then
if test "x$ac_cv_lzma_has_mt" != xno; then
AC_DEFINE([HAVE_LZMA_STREAM_ENCODER_MT], [1], [Define to 1 if you have the `lzma_stream_encoder_mt' function.])
fi
AC_CACHE_CHECK(
[whether we have ARM64 filter support in lzma],
ac_cv_lzma_has_arm64,
[AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <lzma.h>]
[#ifndef LZMA_FILTER_ARM64]
[#error unsupported]
[#endif]])],
[ac_cv_lzma_has_arm64=yes], [ac_cv_lzma_has_arm64=no])])
if test "x$ac_cv_lzma_has_arm64" != xno; then
AC_DEFINE([HAVE_LZMA_FILTER_ARM64], [1], [Define to 1 if you have the `LZMA_FILTER_ARM64' macro.])
fi
fi
AC_ARG_WITH([lzo2],
@@ -552,7 +571,7 @@ if test "x$with_xml2" != "xno"; then
], [
AC_CHECK_LIB(xml2,xmlInitParser)
])
AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h])
AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h libxml/xmlversion.h])
fi
if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then
if test "x$with_expat" != "xno"; then
@@ -805,20 +824,25 @@ AC_FUNC_VPRINTF
# To avoid necessity for including windows.h or special forward declaration
# workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *'
AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *])
AC_CHECK_FUNCS([arc4random_buf chflags chown chroot ctime_r])
AC_CHECK_FUNCS([arc4random_buf chflags chown chroot])
AC_CHECK_FUNCS([closefrom close_range ctime_r])
AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fnmatch fork])
AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate])
AC_CHECK_FUNCS([futimens futimes futimesat])
AC_CHECK_FUNCS([geteuid getline getpid getgrgid_r getgrnam_r])
AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r])
AC_CHECK_FUNCS([getegid geteuid getline getpid getresgid getresuid])
AC_CHECK_FUNCS([getgrgid_r getgrnam_r getpwnam_r getpwuid_r])
AC_CHECK_FUNCS([gettimeofday getvfsbyname gmtime_r])
AC_CHECK_FUNCS([issetugid])
AC_CHECK_FUNCS([lchflags lchmod lchown link linkat localtime_r lstat lutimes])
AC_CHECK_FUNCS([mbrtowc memmove memset])
AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp])
AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat])
AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawn posix_spawnp])
AC_CHECK_FUNCS([readlink readlinkat])
AC_CHECK_FUNCS([readpassphrase])
AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs])
AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strnlen strrchr symlink])
AC_CHECK_FUNCS([sysconf])
AC_CHECK_FUNCS([tcgetattr tcsetattr])
AC_CHECK_FUNCS([timegm tzset unlinkat unsetenv utime utimensat utimes vfork])
AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove])
AC_CHECK_FUNCS([_fseeki64 _get_timezone])
@@ -864,14 +888,6 @@ AC_CHECK_TYPES(struct statfs,,,
#include <sys/mount.h>
])
# There are several variants of readdir_r around; we only
# accept the POSIX-compliant version.
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <dirent.h>]],
[[DIR *dir; struct dirent e, *r;
return(readdir_r(dir, &e, &r));]])],
[AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])]
)
# dirfd can be either a function or a macro.
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <dirent.h>
@@ -912,6 +928,10 @@ if test "x$enable_xattr" != "xno"; then
])
AC_CHECK_DECLS([XATTR_NOFOLLOW], [], [], [#include <sys/xattr.h>
])
ATTR_PC_VER=`$PKG_CONFIG --modversion libattr`
if test "x$ATTR_PC_VER" != "x"; then
AC_DEFINE_UNQUOTED([LIBATTR_PKGCONFIG_VERSION], ["$ATTR_PC_VER"], [Libattr version coming from pkg-config.])
fi
if test "x$ac_cv_header_sys_xattr_h" = "xyes" \
-a "x$ac_cv_have_decl_XATTR_NOFOLLOW" = "xyes"; then
# Darwin extended attributes support
@@ -923,9 +943,7 @@ if test "x$enable_xattr" != "xno"; then
listxattr \
setxattr,
[ac_cv_archive_xattr_darwin=yes],
[ac_cv_archive_xattr_darwin=no],
[#include <sys/xattr.h>
])
[ac_cv_archive_xattr_darwin=no])
]
)
elif test "x$ac_cv_header_sys_extattr_h" = "xyes" \
@@ -941,10 +959,7 @@ if test "x$enable_xattr" != "xno"; then
extattr_set_fd \
extattr_set_link,
[ac_cv_archive_xattr_freebsd=yes],
[ac_cv_archive_xattr_freebsd=no],
[#include <sys/types.h>
#include <sys/extattr.h>
])
[ac_cv_archive_xattr_freebsd=no])
]
)
elif test "x$ac_cv_header_sys_xattr_h" = "xyes" \
@@ -960,17 +975,7 @@ if test "x$enable_xattr" != "xno"; then
llistxattr \
lsetxattr,
[ac_cv_archive_xattr_linux=yes],
[ac_cv_archive_xattr_linux=no],
[#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_XATTR_H
#include <sys/xattr.h>
#endif
#if HAVE_ATTR_XATTR_H
#include <attr/xatr.h>
#endif
])
[ac_cv_archive_xattr_linux=no])
]
)
elif test "x$ac_cv_header_sys_ea_h" = "xyes"; then
@@ -985,9 +990,7 @@ if test "x$enable_xattr" != "xno"; then
llistea \
lsetea,
[ac_cv_archive_xattr_aix=yes],
[ac_cv_archive_xattr_aix=no],
[#include <sys/ea.h>
])
[ac_cv_archive_xattr_aix=no])
]
)
fi
@@ -1024,7 +1027,10 @@ AC_ARG_ENABLE([acl],
if test "x$enable_acl" != "xno"; then
# Libacl
AC_CHECK_LIB([acl], [acl_get_file])
ACL_PC_VER=`$PKG_CONFIG --modversion libacl`
if test "x$ACL_PC_VER" != "x"; then
AC_DEFINE_UNQUOTED([LIBACL_PKGCONFIG_VERSION], ["$ACL_PC_VER"], [Libacl version coming from pkg-config.])
fi
AC_CHECK_TYPES([acl_t, acl_entry_t, acl_permset_t, acl_tag_t], [], [], [
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -1035,7 +1041,10 @@ if test "x$enable_acl" != "xno"; then
])
AC_CHECK_LIB([richacl], [richacl_get_file])
RICHACL_PC_VER=`$PKG_CONFIG --modversion librichacl`
if test "x$RICHACL_PC_VER" != "x"; then
AC_DEFINE_UNQUOTED([LIBRICHACL_PKGCONFIG_VERSION], ["$RICHACL_PC_VER"], [Librichacl version coming from pkg-config.])
fi
AC_CHECK_TYPES([[struct richace], [struct richacl]], [], [], [
#if HAVE_SYS_RICHACL_H
#include <sys/richacl.h>
@@ -1056,7 +1065,7 @@ if test "x$enable_acl" != "xno"; then
richacl_get_file \
richacl_set_fd \
richacl_set_file,
[ac_cv_archive_acl_librichacl=yes], [ac_cv_archive_acl_librichacl=no], [#include <sys/richacl.h>])])
[ac_cv_archive_acl_librichacl=yes], [ac_cv_archive_acl_librichacl=no])])
fi
if test "x$ac_cv_func_acl" = "xyes" \
@@ -1098,14 +1107,7 @@ if test "x$enable_acl" != "xno"; then
acl_set_file \
acl_set_qualifier \
acl_set_tag_type,
[ac_cv_posix_acl_funcs=yes], [ac_cv_posix_acl_funcs=no],
[#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_ACL_H
#include <sys/acl.h>
#endif
])
[ac_cv_posix_acl_funcs=yes], [ac_cv_posix_acl_funcs=no])
])
AC_CHECK_FUNCS(acl_get_perm)
@@ -1132,14 +1134,11 @@ if test "x$enable_acl" != "xno"; then
acl_is_trivial_np \
acl_set_entry_type_np \
acl_set_fd_np \
acl_set_link_np,,,
[#include <sys/types.h>
#include <sys/acl.h>])
acl_set_link_np)
AC_CHECK_FUNCS(mbr_uid_to_uuid \
mbr_uuid_to_id \
mbr_gid_to_uuid,,,
[#include <membership.h>])
mbr_gid_to_uuid)
AC_CHECK_DECLS([ACL_TYPE_EXTENDED, ACL_TYPE_NFS4, ACL_USER,
ACL_SYNCHRONIZE], [], [],
@@ -1295,24 +1294,26 @@ main(int argc, char **argv)
case "$host_os" in
*mingw* | *cygwin* | *msys*)
;;
*darwin*)
CRYPTO_CHECK(MD5, LIBSYSTEM, md5)
CRYPTO_CHECK(SHA1, LIBSYSTEM, sha1)
CRYPTO_CHECK(SHA256, LIBSYSTEM, sha256)
CRYPTO_CHECK(SHA384, LIBSYSTEM, sha384)
CRYPTO_CHECK(SHA512, LIBSYSTEM, sha512)
;;
*)
CRYPTO_CHECK(MD5, LIBC, md5)
CRYPTO_CHECK(MD5, LIBSYSTEM, md5)
CRYPTO_CHECK(RMD160, LIBC, rmd160)
CRYPTO_CHECK(SHA1, LIBC, sha1)
CRYPTO_CHECK(SHA1, LIBSYSTEM, sha1)
CRYPTO_CHECK(SHA256, LIBC, sha256)
CRYPTO_CHECK(SHA256, LIBC2, sha256)
CRYPTO_CHECK(SHA256, LIBC3, sha256)
CRYPTO_CHECK(SHA256, LIBSYSTEM, sha256)
CRYPTO_CHECK(SHA384, LIBC, sha384)
CRYPTO_CHECK(SHA384, LIBC2, sha384)
CRYPTO_CHECK(SHA384, LIBC3, sha384)
CRYPTO_CHECK(SHA384, LIBSYSTEM, sha384)
CRYPTO_CHECK(SHA512, LIBC, sha512)
CRYPTO_CHECK(SHA512, LIBC2, sha512)
CRYPTO_CHECK(SHA512, LIBC3, sha512)
CRYPTO_CHECK(SHA512, LIBSYSTEM, sha512)
;;
esac
@@ -1328,6 +1329,7 @@ fi
if test "x$with_mbedtls" = "xyes"; then
AC_CHECK_HEADERS([mbedtls/aes.h mbedtls/md.h mbedtls/pkcs5.h])
AC_CHECK_HEADERS([mbedtls/version.h])
saved_LIBS=$LIBS
AC_CHECK_LIB(mbedcrypto,mbedtls_sha1_init)
CRYPTO_CHECK(MD5, MBEDTLS, md5)
@@ -1344,6 +1346,7 @@ fi
if test "x$with_nettle" = "xyes"; then
AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h])
AC_CHECK_HEADERS([nettle/pbkdf2.h nettle/aes.h nettle/hmac.h])
AC_CHECK_HEADERS([nettle/version.h])
saved_LIBS=$LIBS
AC_CHECK_LIB(nettle,nettle_sha1_init)
CRYPTO_CHECK(MD5, NETTLE, md5)
@@ -1358,7 +1361,7 @@ if test "x$with_nettle" = "xyes"; then
fi
if test "x$with_openssl" != "xno"; then
AC_CHECK_HEADERS([openssl/evp.h])
AC_CHECK_HEADERS([openssl/evp.h openssl/opensslv.h])
saved_LIBS=$LIBS
LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }libcrypto"
AC_CHECK_LIB(crypto,OPENSSL_config)
@@ -1375,9 +1378,8 @@ AC_SUBST(LIBSREQUIRED)
# Probe libmd AFTER OpenSSL/libcrypto.
# The two are incompatible and OpenSSL is more complete.
AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h])
saved_LIBS=$LIBS
AC_CHECK_LIB(md,MD5Init)
AC_CHECK_LIB(md, MD5Init)
CRYPTO_CHECK(MD5, LIBMD, md5)
CRYPTO_CHECK(RMD160, LIBMD, rmd160)
CRYPTO_CHECK(SHA1, LIBMD, sha1)
+24 -2
View File
@@ -26,6 +26,8 @@ LOCAL_PATH := $(subst /contrib/android,,$(call my-dir))
libarchive_target_config := contrib/android/config/android.h
libarchive_src_files := libarchive/archive_acl.c \
libarchive/archive_blake2s_ref.c \
libarchive/archive_blake2sp_ref.c \
libarchive/archive_check_magic.c \
libarchive/archive_cmdline.c \
libarchive/archive_cryptor.c \
@@ -37,13 +39,14 @@ libarchive_src_files := libarchive/archive_acl.c \
libarchive/archive_entry_stat.c \
libarchive/archive_entry_strmode.c \
libarchive/archive_entry_xattr.c \
libarchive/archive_getdate.c \
libarchive/archive_hmac.c \
libarchive/archive_match.c \
libarchive/archive_options.c \
libarchive/archive_pack_dev.c \
libarchive/archive_parse_date.c \
libarchive/archive_pathmatch.c \
libarchive/archive_ppmd7.c \
libarchive/archive_ppmd8.c \
libarchive/archive_random.c \
libarchive/archive_rb.c \
libarchive/archive_read.c \
@@ -86,6 +89,7 @@ libarchive_src_files := libarchive/archive_acl.c \
libarchive/archive_read_support_format_lha.c \
libarchive/archive_read_support_format_mtree.c \
libarchive/archive_read_support_format_rar.c \
libarchive/archive_read_support_format_rar5.c \
libarchive/archive_read_support_format_raw.c \
libarchive/archive_read_support_format_tar.c \
libarchive/archive_read_support_format_warc.c \
@@ -93,6 +97,7 @@ libarchive_src_files := libarchive/archive_acl.c \
libarchive/archive_read_support_format_zip.c \
libarchive/archive_string.c \
libarchive/archive_string_sprintf.c \
libarchive/archive_time.c \
libarchive/archive_util.c \
libarchive/archive_version_details.c \
libarchive/archive_virtual.c \
@@ -123,7 +128,9 @@ libarchive_src_files := libarchive/archive_acl.c \
libarchive/archive_write_set_format_ar.c \
libarchive/archive_write_set_format_by_name.c \
libarchive/archive_write_set_format_cpio.c \
libarchive/archive_write_set_format_cpio_binary.c \
libarchive/archive_write_set_format_cpio_newc.c \
libarchive/archive_write_set_format_cpio_odc.c \
libarchive/archive_write_set_format_iso9660.c \
libarchive/archive_write_set_format_mtree.c \
libarchive/archive_write_set_format_pax.c \
@@ -151,7 +158,9 @@ else
libarchive_host_src_files :=
endif
libarchive_fe_src_files := libarchive_fe/err.c \
libarchive_fe_src_files := libarchive_fe/lafe_err.c \
libarchive_fe/lafe_fnmatch.c \
libarchive_fe/lafe_getline.c \
libarchive_fe/line_reader.c \
libarchive_fe/passphrase.c
@@ -305,4 +314,17 @@ LOCAL_SRC_FILES := $(bsdcat_src_files)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/libarchive $(LOCAL_PATH)/libarchive_fe $(LOCAL_PATH)/contrib/android/include
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE := bsdtar-recovery
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_STEM := bsdtar
LOCAL_CFLAGS := -DBSDTAR_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\"
LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe libz
LOCAL_SRC_FILES := $(bsdtar_src_files)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/libarchive $(LOCAL_PATH)/libarchive_fe $(LOCAL_PATH)/contrib/android/include
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_FORCE_STATIC_EXECUTABLE := true
include $(BUILD_EXECUTABLE)
endif
+9 -1
View File
@@ -26,6 +26,8 @@
#ifndef ARCHIVE_PLATFORM_H_ANDROID_INCLUDED
#define ARCHIVE_PLATFORM_H_ANDROID_INCLUDED
#define __LIBARCHIVE_CONFIG_H_INCLUDED 1
#include <android/api-level.h>
#ifdef __ANDROID_API__
#if __ANDROID_API__ > 20
@@ -40,6 +42,8 @@
#define HAVE_CHOWN 1
#define HAVE_CHROOT 1
#define HAVE_CLOSEFROM 0
#define HAVE_CLOSE_RANGE 0
#define HAVE_CTIME_R 1
#define HAVE_CTYPE_H 1
#define HAVE_DECL_EXTATTR_NAMESPACE_USER 0
@@ -53,6 +57,8 @@
#define HAVE_DECL_UINTMAX_MAX 1
#define HAVE_DECL_UINT32_MAX 1
#define HAVE_DECL_UINT64_MAX 1
#define HAVE_DECL_INT32_MAX 1
#define HAVE_DECL_INT32_MIN 1
#define HAVE_DIRENT_H 1
#define HAVE_DIRFD 1
#define HAVE_DLFCN_H 1
@@ -135,7 +141,7 @@
#define HAVE_STRING_H 1
#define HAVE_STRRCHR 1
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
#define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
#define HAVE_STRUCT_STAT_ST_MTIME_NSEC 0
#define HAVE_STRUCT_TM_TM_GMTOFF 1
#define HAVE_SYMLINK 1
#define HAVE_SYS_CDEFS_H 1
@@ -151,6 +157,8 @@
#define HAVE_SYS_UTSNAME_H 1
#define HAVE_SYS_VFS_H 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_TCGETATTR 1
#define HAVE_TCSETATTR 1
#define HAVE_TIME_H 1
#define HAVE_TZSET 1
#define HAVE_UINTMAX_T 1
+5 -1
View File
@@ -28,6 +28,8 @@
#define HAVE_CHOWN 1
#define HAVE_CHROOT 1
#define HAVE_CLOSEFROM 1
#define HAVE_CLOSE_RANGE 1
#define HAVE_CTIME_R 1
#define HAVE_CTYPE_H 1
#define HAVE_DECL_EXTATTR_NAMESPACE_USER 0
@@ -153,6 +155,8 @@
#define HAVE_SYS_VFS_H 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_SYS_XATTR_H 1
#define HAVE_TCGETATTR 1
#define HAVE_TCSETATTR 1
#define HAVE_TIMEGM 1
#define HAVE_TIME_H 1
#define HAVE_TZSET 1
@@ -178,7 +182,7 @@
#define HAVE_WMEMCMP 1
#define HAVE_WMEMCPY 1
#define HAVE_ZLIB_H 1
#define ICONV_CONST
#define ICONV_CONST
#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
#define SIZEOF_WCHAR_T 4
#define STDC_HEADERS 1
+12 -9
View File
@@ -175,6 +175,12 @@
/* Define to 1 if you have the `chroot' function. */
/* #undef HAVE_CHROOT */
/* Define to 1 if you have the `closefrom' function. */
/* #undef HAVE_CLOSEFROM */
/* Define to 1 if you have the `close_range' function. */
/* #undef HAVE_CLOSE_RANGE */
/* Define to 1 if you have the <copyfile.h> header file. */
/* #undef HAVE_COPYFILE_H */
@@ -530,9 +536,6 @@
/* Define to 1 if you have the <lz4.h> header file. */
/* #undef HAVE_LZ4_H */
/* Define to 1 if you have the <lzmadec.h> header file. */
/* #undef HAVE_LZMADEC_H */
/* Define to 1 if you have the <lzma.h> header file. */
/* #undef HAVE_LZMA_H */
@@ -623,9 +626,6 @@
/* Define to 1 if you have the <pwd.h> header file. */
/* #undef HAVE_PWD_H */
/* Define to 1 if you have a POSIX compatible readdir_r */
#define HAVE_READDIR_R 1
/* Define to 1 if you have the `readlink' function. */
/* #undef HAVE_READLINK */
@@ -827,6 +827,12 @@
/* Define to 1 if you have the <sys/xattr.h> header file. */
/* #undef HAVE_SYS_XATTR_H */
/* Define to 1 if you have the `tcgetattr' function. */
/* #undef HAVE_TCGETATTR */
/* Define to 1 if you have the `tcsetattr' function. */
/* #undef HAVE_TCSETATTR */
/* Define to 1 if you have the `timegm' function. */
/* #undef HAVE_TIMEGM */
@@ -893,9 +899,6 @@
/* Define to 1 if you have the <wctype.h> header file. */
#define HAVE_WCTYPE_H 1
/* Define to 1 if you have the <wincrypt.h> header file. */
#define HAVE_WINCRYPT_H 1
/* Define to 1 if you have the <windows.h> header file. */
#define HAVE_WINDOWS_H 1
+1 -2
View File
@@ -1,4 +1,4 @@
/*
/*
* Macros for file64 functions
*
* Android does not support the macro _FILE_OFFSET_BITS=64
@@ -19,7 +19,6 @@
#include <sys/vfs.h>
//dirent.h
#define readdir_r readdir64_r
#define readdir readdir64
#define dirent dirent64
//fcntl.h
-1
View File
@@ -22,7 +22,6 @@ BuildRequires: libzstd-devel
BuildRequires: lz4-devel
BuildRequires: lzo-devel
BuildRequires: openssl-devel
BuildRequires: sharutils
BuildRequires: xz-devel
BuildRequires: zlib-devel
+156
View File
@@ -0,0 +1,156 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef LIBARCHIVE_FUZZ_HELPERS_H_
#define LIBARCHIVE_FUZZ_HELPERS_H_
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <ftw.h>
#include <unistd.h>
#include "archive.h"
// Default maximum input size for fuzzers
static constexpr size_t kDefaultMaxInputSize = 256 * 1024; // 256KB
// Buffer structure for archive reading callbacks
struct Buffer {
const uint8_t* data;
size_t size;
size_t pos;
};
// Archive read callback function
static la_ssize_t reader_callback(struct archive* a, void* client_data,
const void** buffer) {
(void)a;
Buffer* buf = static_cast<Buffer*>(client_data);
if (buf->pos >= buf->size) {
return 0; // EOF
}
*buffer = buf->data + buf->pos;
size_t remaining = buf->size - buf->pos;
buf->pos = buf->size; // Consume all remaining data
return static_cast<la_ssize_t>(remaining);
}
// Helper class for consuming fuzz data in structured ways
class DataConsumer {
public:
DataConsumer(const uint8_t* data, size_t size)
: data_(data), size_(size), pos_(0) {}
bool empty() const { return pos_ >= size_; }
size_t remaining() const { return size_ - pos_; }
uint8_t consume_byte() {
if (pos_ >= size_) return 0;
return data_[pos_++];
}
uint16_t consume_u16() {
uint16_t val = 0;
if (pos_ + 2 <= size_) {
val = static_cast<uint16_t>(data_[pos_]) |
(static_cast<uint16_t>(data_[pos_ + 1]) << 8);
pos_ += 2;
}
return val;
}
uint32_t consume_u32() {
uint32_t val = 0;
if (pos_ + 4 <= size_) {
val = static_cast<uint32_t>(data_[pos_]) |
(static_cast<uint32_t>(data_[pos_ + 1]) << 8) |
(static_cast<uint32_t>(data_[pos_ + 2]) << 16) |
(static_cast<uint32_t>(data_[pos_ + 3]) << 24);
pos_ += 4;
}
return val;
}
int64_t consume_i64() {
int64_t val = 0;
if (pos_ + 8 <= size_) {
for (int i = 0; i < 8; i++) {
val |= static_cast<int64_t>(data_[pos_ + i]) << (8 * i);
}
pos_ += 8;
}
return val;
}
// Consume a null-terminated string up to max_len characters
// Returns pointer to internal buffer (valid until next consume_string call)
const char* consume_string(size_t max_len) {
if (max_len > sizeof(string_buf_) - 1) {
max_len = sizeof(string_buf_) - 1;
}
size_t avail = size_ - pos_;
size_t len = (avail < max_len) ? avail : max_len;
size_t actual_len = 0;
while (actual_len < len && pos_ < size_) {
char c = static_cast<char>(data_[pos_++]);
if (c == '\0') break;
string_buf_[actual_len++] = c;
}
string_buf_[actual_len] = '\0';
return string_buf_;
}
// Consume raw bytes into a buffer
size_t consume_bytes(void* out, size_t len) {
size_t avail = size_ - pos_;
size_t to_copy = (avail < len) ? avail : len;
if (to_copy > 0) {
memcpy(out, data_ + pos_, to_copy);
pos_ += to_copy;
}
return to_copy;
}
// Get remaining data as a buffer
const uint8_t* remaining_data() const {
return data_ + pos_;
}
private:
const uint8_t* data_;
size_t size_;
size_t pos_;
char string_buf_[512];
};
// Callback for nftw to remove files/directories
static int remove_callback(const char* fpath, const struct stat* sb,
int typeflag, struct FTW* ftwbuf) {
(void)sb;
(void)typeflag;
(void)ftwbuf;
return remove(fpath);
}
// Recursively remove a directory tree (safer than system("rm -rf ..."))
static int remove_directory_tree(const char* path) {
// nftw with FTW_DEPTH processes directory contents before the directory itself
return nftw(path, remove_callback, 64, FTW_DEPTH | FTW_PHYS);
}
#endif // LIBARCHIVE_FUZZ_HELPERS_H_
@@ -0,0 +1,63 @@
/*
* 7-Zip format specific fuzzer for libarchive
* Targets 7-Zip parsing and decompression code paths
*/
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include "archive.h"
#include "archive_entry.h"
#include "fuzz_helpers.h"
static constexpr size_t kMaxInputSize = 512 * 1024; // 512KB
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
if (len == 0 || len > kMaxInputSize) {
return 0;
}
struct archive *a = archive_read_new();
if (a == NULL) {
return 0;
}
// Enable 7-Zip format specifically
archive_read_support_format_7zip(a);
// Enable all filters for 7z internal compression
archive_read_support_filter_all(a);
// Set passphrase for encrypted archives
archive_read_add_passphrase(a, "password");
Buffer buffer = {buf, len, 0};
if (archive_read_open(a, &buffer, NULL, reader_callback, NULL) != ARCHIVE_OK) {
archive_read_free(a);
return 0;
}
std::vector<uint8_t> data_buffer(4096, 0);
struct archive_entry *entry;
while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
// Exercise entry metadata access
archive_entry_pathname(entry);
archive_entry_pathname_w(entry);
archive_entry_size(entry);
archive_entry_mtime(entry);
archive_entry_mode(entry);
archive_entry_is_encrypted(entry);
archive_entry_is_data_encrypted(entry);
archive_entry_is_metadata_encrypted(entry);
// Read data
ssize_t r;
while ((r = archive_read_data(a, data_buffer.data(), data_buffer.size())) > 0)
;
}
archive_read_free(a);
return 0;
}
@@ -0,0 +1,47 @@
# 7-Zip format dictionary
# Magic bytes
"7z\xbc\xaf\x27\x1c"
"\x37\x7a\xbc\xaf\x27\x1c"
# Common property IDs
"\x00"
"\x01"
"\x02"
"\x03"
"\x04"
"\x05"
"\x06"
"\x07"
"\x08"
"\x09"
"\x0a"
"\x0b"
"\x0c"
"\x0d"
"\x0e"
"\x0f"
"\x10"
"\x11"
"\x17"
"\x19"
"\x21"
"\x23"
"\x24"
"\x25"
# Compression method IDs
"\x00\x00"
"\x00\x03"
"\x00\x04"
"\x00\x06"
"\x01\x01"
"\x03\x01\x01"
"\x04\x01\x08"
"\x04\x02\x02"
"\x21\x01"
"\x30\x01\x01"
# Encryption
"\x06\xf1\x07\x01"
"Password"
"password"
@@ -0,0 +1,10 @@
[libfuzzer]
max_len = 524288
timeout = 60
rss_limit_mb = 2048
[honggfuzz]
timeout = 60
[afl]
timeout = 60
+54
View File
@@ -0,0 +1,54 @@
/*
* AR (Unix archive) format fuzzer for libarchive
* Tests BSD and GNU ar formats
*/
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include "archive.h"
#include "archive_entry.h"
#include "fuzz_helpers.h"
static constexpr size_t kMaxInputSize = 512 * 1024;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
if (len == 0 || len > kMaxInputSize) {
return 0;
}
struct archive *a = archive_read_new();
if (a == NULL) {
return 0;
}
archive_read_support_format_ar(a);
archive_read_support_filter_all(a);
Buffer buffer = {buf, len, 0};
if (archive_read_open(a, &buffer, NULL, reader_callback, NULL) != ARCHIVE_OK) {
archive_read_free(a);
return 0;
}
std::vector<uint8_t> data_buffer(4096, 0);
struct archive_entry *entry;
while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
archive_entry_pathname(entry);
archive_entry_size(entry);
archive_entry_mtime(entry);
archive_entry_mode(entry);
archive_entry_uid(entry);
archive_entry_gid(entry);
ssize_t r;
while ((r = archive_read_data(a, data_buffer.data(), data_buffer.size())) > 0)
;
}
archive_read_free(a);
return 0;
}
@@ -0,0 +1,20 @@
# AR format dictionary
# AR magic
"!<arch>\x0a"
# File header terminator
"\x60\x0a"
# Special entries
"/"
"//"
"/SYM64/"
# Common permissions
"100644 "
"100755 "
# UID/GID fields
"0 "
"1000 "
+51
View File
@@ -0,0 +1,51 @@
/*
* CAB (Microsoft Cabinet) format fuzzer for libarchive
*/
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include "archive.h"
#include "archive_entry.h"
#include "fuzz_helpers.h"
static constexpr size_t kMaxInputSize = 512 * 1024;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
if (len == 0 || len > kMaxInputSize) {
return 0;
}
struct archive *a = archive_read_new();
if (a == NULL) {
return 0;
}
archive_read_support_format_cab(a);
archive_read_support_filter_all(a);
Buffer buffer = {buf, len, 0};
if (archive_read_open(a, &buffer, NULL, reader_callback, NULL) != ARCHIVE_OK) {
archive_read_free(a);
return 0;
}
std::vector<uint8_t> data_buffer(4096, 0);
struct archive_entry *entry;
while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
archive_entry_pathname(entry);
archive_entry_size(entry);
archive_entry_mtime(entry);
archive_entry_mode(entry);
ssize_t r;
while ((r = archive_read_data(a, data_buffer.data(), data_buffer.size())) > 0)
;
}
archive_read_free(a);
return 0;
}
@@ -0,0 +1,23 @@
# CAB (Microsoft Cabinet) format dictionary
# CAB signature
"MSCF"
"\x4d\x53\x43\x46"
# Version
"\x03\x01"
# Compression types
"\x00\x00"
"\x01\x00"
"\x02\x00"
"\x03\x00"
# Folder count patterns
"\x01\x00"
"\x02\x00"
# Header flags
"\x00\x00"
"\x01\x00"
"\x04\x00"
@@ -0,0 +1,58 @@
/*
* CPIO format fuzzer for libarchive
* Tests all CPIO variants: binary, odc, newc, crc
*/
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include "archive.h"
#include "archive_entry.h"
#include "fuzz_helpers.h"
static constexpr size_t kMaxInputSize = 512 * 1024;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
if (len == 0 || len > kMaxInputSize) {
return 0;
}
struct archive *a = archive_read_new();
if (a == NULL) {
return 0;
}
archive_read_support_format_cpio(a);
archive_read_support_filter_all(a);
Buffer buffer = {buf, len, 0};
if (archive_read_open(a, &buffer, NULL, reader_callback, NULL) != ARCHIVE_OK) {
archive_read_free(a);
return 0;
}
std::vector<uint8_t> data_buffer(4096, 0);
struct archive_entry *entry;
while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
archive_entry_pathname(entry);
archive_entry_size(entry);
archive_entry_mtime(entry);
archive_entry_mode(entry);
archive_entry_uid(entry);
archive_entry_gid(entry);
archive_entry_ino(entry);
archive_entry_nlink(entry);
archive_entry_rdev(entry);
archive_entry_hardlink(entry);
ssize_t r;
while ((r = archive_read_data(a, data_buffer.data(), data_buffer.size())) > 0)
;
}
archive_read_free(a);
return 0;
}
@@ -0,0 +1,25 @@
# CPIO format dictionary
# Binary magic (little endian)
"\xc7\x71"
# Binary magic (big endian)
"\x71\xc7"
# ASCII odc magic
"070707"
# ASCII newc magic
"070701"
# ASCII crc magic
"070702"
# Common trailer
"TRAILER!!!"
# Common field patterns
"00000000"
"00000001"
"000001ed"
"000003e8"
@@ -0,0 +1,101 @@
/*
* Encrypted archive fuzzer for libarchive
* Tests password/passphrase handling across formats
*/
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <vector>
#include "archive.h"
#include "archive_entry.h"
#include "fuzz_helpers.h"
static constexpr size_t kMaxInputSize = 512 * 1024;
// Passphrase callback for testing
static const char *test_passphrases[] = {
"password",
"test",
"123456",
"",
"secret",
NULL
};
static int passphrase_idx = 0;
static const char* passphrase_callback(struct archive *a, void *client_data) {
(void)a;
(void)client_data;
const char *pass = test_passphrases[passphrase_idx];
if (pass != NULL) {
passphrase_idx++;
}
return pass;
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
if (len == 0 || len > kMaxInputSize) {
return 0;
}
// Reset passphrase index
passphrase_idx = 0;
struct archive *a = archive_read_new();
if (a == NULL) {
return 0;
}
// Enable all formats that support encryption
archive_read_support_format_zip(a);
archive_read_support_format_7zip(a);
archive_read_support_format_rar(a);
archive_read_support_format_rar5(a);
archive_read_support_filter_all(a);
// Set up passphrase callback
archive_read_set_passphrase_callback(a, NULL, passphrase_callback);
// Also add some static passphrases
archive_read_add_passphrase(a, "password");
archive_read_add_passphrase(a, "test123");
Buffer buffer = {buf, len, 0};
if (archive_read_open(a, &buffer, NULL, reader_callback, NULL) != ARCHIVE_OK) {
archive_read_free(a);
return 0;
}
std::vector<uint8_t> data_buffer(4096, 0);
struct archive_entry *entry;
int entry_count = 0;
while (archive_read_next_header(a, &entry) == ARCHIVE_OK && entry_count < 100) {
archive_entry_pathname(entry);
// Check encryption status
int is_encrypted = archive_entry_is_encrypted(entry);
int is_data_encrypted = archive_entry_is_data_encrypted(entry);
int is_meta_encrypted = archive_entry_is_metadata_encrypted(entry);
(void)is_encrypted;
(void)is_data_encrypted;
(void)is_meta_encrypted;
// Check if archive has encrypted entries
archive_read_has_encrypted_entries(a);
// Try to read data (may fail due to wrong password)
ssize_t r;
while ((r = archive_read_data(a, data_buffer.data(), data_buffer.size())) > 0)
;
entry_count++;
}
archive_read_free(a);
return 0;
}
@@ -0,0 +1,10 @@
[libfuzzer]
max_len = 524288
timeout = 60
rss_limit_mb = 2048
[honggfuzz]
timeout = 60
[afl]
timeout = 60
+105
View File
@@ -0,0 +1,105 @@
/*
* Archive entry fuzzer for libarchive
* Targets archive_entry_* functions including ACL, linkify, and metadata
*/
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "archive.h"
#include "archive_entry.h"
#include "fuzz_helpers.h"
static constexpr size_t kMaxInputSize = 64 * 1024; // 64KB
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
if (len == 0 || len > kMaxInputSize) {
return 0;
}
DataConsumer consumer(buf, len);
struct archive_entry *entry = archive_entry_new();
if (entry == NULL) {
return 0;
}
// Set basic entry properties
archive_entry_set_pathname(entry, consumer.consume_string(256));
archive_entry_set_size(entry, consumer.consume_i64());
archive_entry_set_mode(entry, consumer.consume_u32());
archive_entry_set_uid(entry, consumer.consume_u32());
archive_entry_set_gid(entry, consumer.consume_u32());
archive_entry_set_mtime(entry, consumer.consume_i64(), 0);
archive_entry_set_atime(entry, consumer.consume_i64(), 0);
archive_entry_set_ctime(entry, consumer.consume_i64(), 0);
archive_entry_set_birthtime(entry, consumer.consume_i64(), 0);
// Set various string fields
archive_entry_set_uname(entry, consumer.consume_string(64));
archive_entry_set_gname(entry, consumer.consume_string(64));
archive_entry_set_symlink(entry, consumer.consume_string(256));
archive_entry_set_hardlink(entry, consumer.consume_string(256));
// Exercise ACL functions (low coverage targets)
int acl_type = consumer.consume_byte() & 0x0F;
int acl_permset = consumer.consume_u32();
int acl_tag = consumer.consume_byte() & 0x0F;
int acl_qual = consumer.consume_u32();
const char *acl_name = consumer.consume_string(64);
archive_entry_acl_add_entry(entry, acl_type, acl_permset, acl_tag, acl_qual, acl_name);
// Add more ACL entries based on remaining data
while (!consumer.empty() && consumer.remaining() > 10) {
acl_type = consumer.consume_byte() & 0x0F;
acl_permset = consumer.consume_u32();
acl_tag = consumer.consume_byte() & 0x0F;
acl_qual = consumer.consume_u32();
acl_name = consumer.consume_string(32);
archive_entry_acl_add_entry(entry, acl_type, acl_permset, acl_tag, acl_qual, acl_name);
}
// Exercise ACL text conversion functions (archive_acl_to_text_* are uncovered)
ssize_t text_len;
char *acl_text = archive_entry_acl_to_text(entry, &text_len, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
if (acl_text) {
// Parse the text back
archive_entry_acl_from_text(entry, acl_text, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
free(acl_text);
}
acl_text = archive_entry_acl_to_text(entry, &text_len, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
if (acl_text) {
free(acl_text);
}
acl_text = archive_entry_acl_to_text(entry, &text_len, ARCHIVE_ENTRY_ACL_TYPE_NFS4);
if (acl_text) {
free(acl_text);
}
// Exercise wide character versions
wchar_t *acl_text_w = archive_entry_acl_to_text_w(entry, &text_len, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
if (acl_text_w) {
free(acl_text_w);
}
// Get pathname variants
archive_entry_pathname(entry);
archive_entry_pathname_w(entry);
archive_entry_pathname_utf8(entry);
// Clone the entry
struct archive_entry *entry2 = archive_entry_clone(entry);
if (entry2) {
archive_entry_free(entry2);
}
// Clear and reuse
archive_entry_clear(entry);
archive_entry_free(entry);
return 0;
}
@@ -0,0 +1,65 @@
/*
* Compression filter fuzzer for libarchive
* Tests decompression of gzip, bzip2, xz, lzma, zstd, lz4, etc.
*/
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include "archive.h"
#include "archive_entry.h"
#include "fuzz_helpers.h"
static constexpr size_t kMaxInputSize = 256 * 1024;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
if (len == 0 || len > kMaxInputSize) {
return 0;
}
struct archive *a = archive_read_new();
if (a == NULL) {
return 0;
}
// Enable raw format (just decompress, no archive format)
archive_read_support_format_raw(a);
// Enable all compression filters
archive_read_support_filter_all(a);
Buffer buffer = {buf, len, 0};
if (archive_read_open(a, &buffer, NULL, reader_callback, NULL) != ARCHIVE_OK) {
archive_read_free(a);
return 0;
}
std::vector<uint8_t> data_buffer(8192, 0);
struct archive_entry *entry;
if (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
// Get filter info
int filter_count = archive_filter_count(a);
for (int i = 0; i < filter_count; i++) {
archive_filter_name(a, i);
archive_filter_code(a, i);
archive_filter_bytes(a, i);
}
// Read all decompressed data
ssize_t total = 0;
ssize_t r;
while ((r = archive_read_data(a, data_buffer.data(), data_buffer.size())) > 0) {
total += r;
// Limit total decompressed size to prevent zip bombs
if (total > 10 * 1024 * 1024) {
break;
}
}
}
archive_read_free(a);
return 0;
}
@@ -0,0 +1,33 @@
# Compression filter dictionary
# GZIP magic
"\x1f\x8b"
"\x1f\x8b\x08"
# BZIP2 magic
"BZh"
"BZ0"
# XZ magic
"\xfd7zXZ\x00"
# LZMA magic
"\x5d\x00\x00"
# ZSTD magic
"\x28\xb5\x2f\xfd"
# LZ4 magic
"\x04\x22\x4d\x18"
# Compress (.Z) magic
"\x1f\x9d"
# LZIP magic
"LZIP"
# LRZIP magic
"LRZI"
# LZO magic
"\x89LZO\x00\x0d\x0a\x1a\x0a"
@@ -0,0 +1,10 @@
[libfuzzer]
max_len = 262144
timeout = 30
rss_limit_mb = 2048
[honggfuzz]
timeout = 30
[afl]
timeout = 30
+2 -15
View File
@@ -3,20 +3,7 @@
#include <vector>
#include "archive.h"
struct Buffer {
const uint8_t *buf;
size_t len;
};
ssize_t reader_callback(struct archive *a, void *client_data,
const void **block) {
Buffer *buffer = reinterpret_cast<Buffer *>(client_data);
*block = buffer->buf;
ssize_t len = buffer->len;
buffer->len = 0;
return len;
}
#include "fuzz_helpers.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
int ret;
@@ -26,7 +13,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
archive_read_support_filter_all(a);
archive_read_support_format_all(a);
Buffer buffer = {buf, len};
Buffer buffer = {buf, len, 0};
archive_read_open(a, &buffer, NULL, reader_callback, NULL);
std::vector<uint8_t> data_buffer(getpagesize(), 0);
+76
View File
@@ -0,0 +1,76 @@
# General libarchive dictionary covering multiple formats
# TAR magic
"ustar"
"ustar\x00"
"ustar \x00"
"\x00\x00"
# ZIP magic
"PK\x03\x04"
"PK\x05\x06"
"PK\x01\x02"
"PK\x07\x08"
# 7z magic
"7z\xbc\xaf\x27\x1c"
# RAR magic
"Rar!\x1a\x07\x00"
"Rar!\x1a\x07\x01\x00"
# XAR magic
"xar!"
# CPIO magic
"\xc7\x71"
"070701"
"070702"
"070707"
# CAB magic
"MSCF"
# LHA magic
"-lh"
"-lz"
# AR magic
"!<arch>\x0a"
# ISO9660 magic
"CD001"
# GZIP magic
"\x1f\x8b"
# BZIP2 magic
"BZ"
"BZh"
# XZ magic
"\xfd7zXZ\x00"
# LZMA magic
"\x5d\x00\x00"
# ZSTD magic
"\x28\xb5\x2f\xfd"
# LZ4 magic
"\x04\x22\x4d\x18"
# Common paths
"/"
"./"
"../"
"./test"
"test.txt"
"test/"
# Common attributes
"\x00\x00\x00\x00"
"\xff\xff\xff\xff"
# Passphrase
"password"
@@ -0,0 +1,9 @@
[libfuzzer]
max_len = 524288
timeout = 30
[honggfuzz]
timeout = 30
[afl]
timeout = 30
@@ -0,0 +1,58 @@
/*
* ISO9660 format fuzzer for libarchive
* Tests ISO, Joliet, and Rock Ridge extensions
*/
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include "archive.h"
#include "archive_entry.h"
#include "fuzz_helpers.h"
static constexpr size_t kMaxInputSize = 1024 * 1024; // 1MB for ISO images
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
if (len == 0 || len > kMaxInputSize) {
return 0;
}
struct archive *a = archive_read_new();
if (a == NULL) {
return 0;
}
archive_read_support_format_iso9660(a);
archive_read_support_filter_all(a);
// Set options to test various ISO extensions
archive_read_set_options(a, "iso9660:joliet,iso9660:rockridge");
Buffer buffer = {buf, len, 0};
if (archive_read_open(a, &buffer, NULL, reader_callback, NULL) != ARCHIVE_OK) {
archive_read_free(a);
return 0;
}
std::vector<uint8_t> data_buffer(4096, 0);
struct archive_entry *entry;
while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
archive_entry_pathname(entry);
archive_entry_pathname_w(entry);
archive_entry_size(entry);
archive_entry_mtime(entry);
archive_entry_mode(entry);
archive_entry_symlink(entry);
archive_entry_hardlink(entry);
ssize_t r;
while ((r = archive_read_data(a, data_buffer.data(), data_buffer.size())) > 0)
;
}
archive_read_free(a);
return 0;
}
@@ -0,0 +1,36 @@
# ISO9660 format dictionary
# Volume descriptor type
"\x00"
"\x01"
"\x02"
"\xff"
# Standard identifier
"CD001"
# Volume descriptor version
"\x01"
# Joliet escape sequences
"%/@"
"%/C"
"%/E"
# Rock Ridge signatures
"SP"
"RR"
"CE"
"PX"
"PN"
"SL"
"NM"
"CL"
"PL"
"RE"
"TF"
"SF"
# System use
"ER"
"ES"
@@ -0,0 +1,10 @@
[libfuzzer]
max_len = 1048576
timeout = 60
rss_limit_mb = 2048
[honggfuzz]
timeout = 60
[afl]
timeout = 60
+54
View File
@@ -0,0 +1,54 @@
/*
* LHA/LZH format fuzzer for libarchive
*/
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include "archive.h"
#include "archive_entry.h"
#include "fuzz_helpers.h"
static constexpr size_t kMaxInputSize = 512 * 1024;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
if (len == 0 || len > kMaxInputSize) {
return 0;
}
struct archive *a = archive_read_new();
if (a == NULL) {
return 0;
}
archive_read_support_format_lha(a);
archive_read_support_filter_all(a);
Buffer buffer = {buf, len, 0};
if (archive_read_open(a, &buffer, NULL, reader_callback, NULL) != ARCHIVE_OK) {
archive_read_free(a);
return 0;
}
std::vector<uint8_t> data_buffer(4096, 0);
struct archive_entry *entry;
while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
archive_entry_pathname(entry);
archive_entry_pathname_w(entry);
archive_entry_size(entry);
archive_entry_mtime(entry);
archive_entry_mode(entry);
archive_entry_uid(entry);
archive_entry_gid(entry);
ssize_t r;
while ((r = archive_read_data(a, data_buffer.data(), data_buffer.size())) > 0)
;
}
archive_read_free(a);
return 0;
}
@@ -0,0 +1,26 @@
# LHA/LZH format dictionary
# Compression methods
"-lh0-"
"-lh1-"
"-lh2-"
"-lh3-"
"-lh4-"
"-lh5-"
"-lh6-"
"-lh7-"
"-lhd-"
"-lzs-"
"-lz4-"
"-lz5-"
# OS type
"\x00"
"\x4d"
"\x55"
# Header levels
"\x00"
"\x01"
"\x02"
"\x03"
Loaded 100 of 868 files, more files were not shown because too many files have changed in this diff. Show more