0
0
mirror of https://github.com/libarchive/libarchive.git synced 2026-01-18 17:11:25 +01:00

7023 Commits

Author SHA1 Message Date
Martin Matuška
a819cc2829 Merge pull request #2797 from mmatuska/fix/treefuncs
Partially revert "Merge pull request #2679 from AZero13/error"
2025-11-28 00:57:09 +01:00
Tim Kientzle
1b9b42720f Merge pull request #2799 from AZero13/idk
Prevent unneeded truncation
2025-11-26 21:08:01 -08:00
AZero13
827905c93f Prevent unneeded truncation
There is no reason we need to cast when every data type involved is size_t
2025-11-26 15:35:54 -05:00
Martin Matuska
aac59c1bd5 Partially revert "Merge pull request #2679 from AZero13/error"
This reverts commit d8aaf88c9f, reversing
changes made to ee49ac8106.

tree_reopen() and tree_dup() return NULL only of they
are unable to allocate memory. Otherwise libarchive enters
ARCHIVE_FATAL if trying to walk an enterable but unreadable
directory.

__archive_ensure_cloexec_flag() operates only on fd >= 0
so there is no need to skip it

I have reimplemented the check around fdopendir()

Reported by:	Christian Weisgerber from OpenBSD
2025-11-24 14:16:53 +01:00
vcoxvco
f49372e945 libarchive/archive_util.c:__archive_issetugid: Fix uninitialized variable rgid 2025-11-23 19:27:42 +01:00
Tim Kientzle
8ef2084104 Merge pull request #2791 from KlaraSystems/des/383-fixes
Fix issues encountered while importing 3.8.3 downstream
2025-11-20 22:24:38 -08:00
Tim Kientzle
e17f169356 Merge pull request #2792 from KlaraSystems/des/generate-list
Generate test lists reliably and deterministically
2025-11-20 22:22:32 -08:00
Tim Kientzle
47809f10bf Merge pull request #2793 from bgilbert/rar
Add missing rar5 test case to dist
2025-11-20 22:19:23 -08:00
Tim Kientzle
81bc00a549 Merge pull request #2787 from ljdarj/aar
Fix bsdtar zero-length pattern issue.
2025-11-20 21:40:17 -08:00
ARJANEN Loïc Jean David
3150539edb Fix bsdtar zero-length pattern issue.
Uses the sed-like way (and Java-like, and .Net-like, and Javascript-like…) to fix this issue of advancing the string to be processed by one if the match is zero-length.

Fixes libarchive/libarchive#2725 and solves libarchive/libarchive#2438.
2025-11-21 00:44:38 +01:00
Benjamin Gilbert
8f7d334646 Add missing rar5 test case to dist
Fixes: aafb078b7c ("Update 'archive_mstring_update_utf8' to attempt UTF8->WCS conversion on Windows if MBS conversion fails (#1978)")
2025-11-19 00:12:36 -08:00
Dag-Erling Smørgrav
12522911fa Fix low-hanging type issues 2025-11-19 01:18:18 +01:00
Dag-Erling Smørgrav
1890755ab2 Fix lseek argument order 2025-11-19 01:16:29 +01:00
Dag-Erling Smørgrav
35aac8a925 Fix the condition for using LIBXML_DOTTED_VERSION 2025-11-19 01:15:48 +01:00
Dag-Erling Smørgrav
fdec8c2f24 Improve test list generation
Update the lists of tests reliably and deterministically when the test sources change.
2025-11-19 01:12:50 +01:00
Dag-Erling Smørgrav
2df76f52c2 Clean up the top-level Makefile
Most of this is just moving headers out from *_SOURCES.
2025-11-19 01:05:41 +01:00
Martin Matuška
ce7b3f1c15 Merge pull request #2771 from mostynb/lz4_with_leading_skippable_frames
Support both lz4 and zstd data with leading skippable frames
2025-11-17 20:30:16 +01:00
Martin Matuška
dbacda991c Merge pull request #2751 from KlaraSystems/des/zip_magic_numbers
Avoid magic numbers in zip support code
2025-11-17 20:27:46 +01:00
Martin Matuška
2caee6a37e Merge pull request #2752 from KlaraSystems/des/safe-writes-umask
Set umask before testing safe writes
2025-11-17 20:26:35 +01:00
Martin Matuška
d5bd2dfafe Merge pull request #2755 from mmatuska/fix/cirrusci
CI: update FreeBSD 14 build environment
2025-11-17 20:24:53 +01:00
Tim Kientzle
e1c3061b12 Merge pull request #2783 from YoshiRulz/docs-fix-typo
Fix typo in archive_entry_stat(3) man page
2025-11-16 16:18:03 -08:00
Tim Kientzle
c2333a511d Merge pull request #2738 from cmcgee1024/add_clang_module_map
Add a clang module map for libarchive
2025-11-16 16:17:54 -08:00
YoshiRulz
d8fba4df3a Fix typo in archive_entry_stat(3) man page 2025-11-13 12:46:23 +10:00
Chris McGee
f75b5ddab0 Provide a detailed description of the libarchive module map file 2025-11-12 08:42:03 -05:00
AZero13
02a76f2dc9 Remove unneeded int cast 2025-11-11 11:47:26 -05:00
Tim Kientzle
c5cc510145 Merge pull request #2778 from AZero13/result-0
Set *result to 0 when the tar flush fails.
2025-11-06 20:17:19 -08:00
Tim Kientzle
ab09af7304 Merge pull request #2654 from AZero13/swapping-2
s is a signed int, so make it signed int
2025-11-06 20:15:08 -08:00
Tim Kientzle
e929454ec8 Merge pull request #2779 from AZero13/descriptor
file_open should close if fstat fails
2025-11-06 20:13:10 -08:00
AZero13
3aa9c22ddf file_open should close if fstat fails 2025-11-06 11:14:45 -05:00
AZero13
daf5abf802 Add error handling 2025-11-06 10:46:27 -05:00
Rose
f18a754d02 s is a signed int, so make it signed int 2025-11-06 10:44:16 -05:00
AZero13
3396ba84d7 Set *result to 0 when the tar flush fails.
We should not uninitialize 0 when an error happens. Because t is then checked.
2025-11-06 10:02:41 -05:00
Tim Kientzle
26c769ecdc Merge pull request #2775 from AZero13/off-by-one
[tar] Bounds check newdir_len
2025-11-04 19:30:01 -08:00
AZero13
45a873e998 Bounds check newdir_len
Honestly, this is of little consequence; if old_len is too big the program will crash anyway. However, an error exists just in case.
2025-11-04 19:02:08 -05:00
Tim Kientzle
fa5f70627c Merge pull request #2769 from kientzle/kientzle-issue2765
Fix a buffer overrun when reading truncated 7zip headers
2025-11-02 14:17:48 -08:00
Tim Kientzle
c45a07854d Merge pull request #2772 from moubctez/forget_name_max
Remove name_max leftover
2025-11-02 09:08:31 -08:00
Adam Ciarciński
f80b1ae294 Remove name_max leftover 2025-11-02 09:49:02 +01:00
Mostyn Bramley-Moore
1435c4b20c Skip over LZ4/zstd skippable frames when detecting data format
Since LZ4 and zstd share the same format for skippable frames, we need
to skip over these frames when trying to detect the format of compressed
data. Let's read up to something like 64kb of data when performing this
scanning.

Note that the LZ4 specification advises against starting with a skippable
frame, but doesn't forbid it:
> For the purpose of facilitating identification, it is discouraged to
> start a flow of concatenated frames with a skippable frame. If there
> is a need to start such a flow with some user data encapsulated into
> a skippable frame, it's recommended to start with a zero-byte LZ4
> frame followed by a skippable frame. This will make it easier for
> file type identifiers.

Resolves #2692.
2025-11-01 22:43:38 +01:00
Mostyn Bramley-Moore
989a303793 Test that we can read lz4 data with leading skippable frames
This is expected to fail until a followup commit, because lz4 and zstd
skippable frames are the same format and we don't skip over those when
performing format detection (yet).

Relates to #2692.
2025-11-01 22:23:21 +01:00
Tim Kientzle
f02961f402 Correct the new test expectations 2025-10-31 22:37:33 -07:00
Tim Kientzle
dc6c0c5f35 Fix a buffer overrun when reading truncated 7zip headers
This adjusts the request size for reading data from a 7zip SFX header
to ensure we get enough bytes to cover the following checks.

Resolves #2765
2025-10-31 22:31:45 -07:00
Tim Kientzle
ce614c6524 Merge pull request #2768 from Commandoss/master
Fix for an out-of-bounds buffer overrun when using p[H_LEVEL_OFFSET]
2025-10-31 22:07:19 -07:00
Tim Kientzle
8855146220 Merge pull request #2767 from KlaraSystems/des/posix_spawn
Replace system() with posix_spawn() if available
2025-10-31 07:27:15 -07:00
Tim Kientzle
edbada88c0 Merge pull request #2766 from mostynb/fix_mac_signed_unsigned_comparison
Fix signed-unsigned comparison in add_trivial_nfs4_acl
2025-10-31 07:23:44 -07:00
Илья
212426e751 heap-use-after-free(read) at src/libarchive/archive_read_support_format_lha.c:692:6 2025-10-31 15:23:55 +03:00
Mostyn Bramley-Moore
83c30ee813 Fix signed-unsigned comparison in add_trivial_nfs4_acl
Resolves #2760
2025-10-30 11:29:55 +01:00
Tim Kientzle
d2e861769c Merge pull request #2753 from KlaraSystems/des/temp-files
Create temporary files in the target directory
2025-10-28 17:13:18 -07:00
Martin Matuska
89cbfe1028 CI: update FreeBSD 14 build environment 2025-10-15 23:41:46 +02:00
Dag-Erling Smørgrav
1c08abc60d Create temporary files in the target directory
Whenever we need to create a temporary file while writing to disk on a
POSIX system, try to create it in the same directory as the final file
instead of the current working directory.  The target directory can
reasonably be expected to be writable (and if it isn't, creating the
file will fail anyway), but the current working directory may not be.

While here, consistently use __archive_mkstemp(), and increase the
template from six to eight random characters.

Fixes:		2e73ea3a7d ("Fix max path-length metadata writing (#2243)")
Fixes:		e12c955dca ("Unify temporary directory handling")
2025-10-15 09:41:06 +02:00
Dag-Erling Smørgrav
8fff509f1a Replace system() with posix_spawn() if available
Some platforms disallow system() due to its perceived insecurity.
Luckily, we can be just as insecure using the more palatable
posix_spawn() instead!
2025-10-14 19:17:53 +02:00