]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
3 weeks agofilter: Remove unneeded strcpy calls 3033/head
Tobias Stoeckmann [Thu, 14 May 2026 18:42:13 +0000 (20:42 +0200)] 
filter: Remove unneeded strcpy calls

No need to copy these values on stack. Just use them on heap directly.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoMerge pull request #3028 from br0nzu/xar-fstype-cleanup
Tim Kientzle [Thu, 14 May 2026 02:24:27 +0000 (19:24 -0700)] 
Merge pull request #3028 from br0nzu/xar-fstype-cleanup

Free XAR xattr fstype metadata during cleanup

3 weeks agoMerge pull request #3030 from stoeckmann/xar_atol
Tim Kientzle [Thu, 14 May 2026 01:51:45 +0000 (18:51 -0700)] 
Merge pull request #3030 from stoeckmann/xar_atol

xar: Avoid integer overflows in number parsers

3 weeks agoMerge pull request #3029 from stoeckmann/iso_memleak
Tim Kientzle [Thu, 14 May 2026 01:51:29 +0000 (18:51 -0700)] 
Merge pull request #3029 from stoeckmann/iso_memleak

iso9660: Fix memory leaks on error paths

3 weeks agoxar: Handle integer overflows in atou64 3030/head
Tobias Stoeckmann [Wed, 13 May 2026 17:05:48 +0000 (19:05 +0200)] 
xar: Handle integer overflows in atou64

Parsing a string into an integer also means that boundary checks have to
be performed. Check within atou64 as well as outside by verifying that
subsequent casts won't truncate numbers.

Use error handling available by callers.

Reported by Muhammed Hussein.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoxar: Merge atol8 and atol10 into atou64
Tobias Stoeckmann [Wed, 13 May 2026 16:09:45 +0000 (18:09 +0200)] 
xar: Merge atol8 and atol10 into atou64

Both functions are similar enough that they can be merged.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoxar: Return uint64_T from atol8
Tobias Stoeckmann [Wed, 13 May 2026 16:03:10 +0000 (18:03 +0200)] 
xar: Return uint64_T from atol8

The result of atol8 is cast to mode_t, which is also unsigned.
This brings atol8 closer to atol10.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoxar: Prepare error pass through for xml_data
Tobias Stoeckmann [Wed, 13 May 2026 15:53:49 +0000 (17:53 +0200)] 
xar: Prepare error pass through for xml_data

The xml_data function is void, but some functions called in there might
fail. Prepare an error propagation for upcoming changes.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoxar: Remove unneeded cast
Tobias Stoeckmann [Wed, 13 May 2026 15:52:12 +0000 (17:52 +0200)] 
xar: Remove unneeded cast

The variable is size_t and argument expects a size_t. Do not cast to
int, which could only lead to trouble (in theory).

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoxar: Test overly large mode value
Tobias Stoeckmann [Wed, 13 May 2026 15:42:12 +0000 (17:42 +0200)] 
xar: Test overly large mode value

Add a test which contains a mode which does not fit into mode_t and
check if such an entry is properly rejected.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoiso9660: Fix memory leaks on error paths 3029/head
Tobias Stoeckmann [Wed, 13 May 2026 18:14:21 +0000 (20:14 +0200)] 
iso9660: Fix memory leaks on error paths

- Release memory in case of allocation failure.
- Treat failure to add an entry to rr_moved as fatal error

Fixes ASAN test run with test_write_format_iso9660_null_deref

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoFree XAR xattr fstype metadata 3028/head
br0nzu [Wed, 13 May 2026 07:24:44 +0000 (16:24 +0900)] 
Free XAR xattr fstype metadata

The XAR xattr cleanup helper released the xattr name string but not the parallel fstype archive_string. Release fstype from the same xattr_free() ownership boundary.

3 weeks agoAdd XAR xattr fstype cleanup coverage
br0nzu [Wed, 13 May 2026 07:24:44 +0000 (16:24 +0900)] 
Add XAR xattr fstype cleanup coverage

Add a focused XAR sample with xattr fstype metadata and exercise it through the public read/free path. This gives leak-checking builds coverage for the xattr cleanup ownership boundary.

3 weeks agoMerge pull request #3020 from stoeckmann/sparse_uaf_test
Tim Kientzle [Sun, 10 May 2026 15:45:58 +0000 (08:45 -0700)] 
Merge pull request #3020 from stoeckmann/sparse_uaf_test

sparse: Add archive_entry_sparse_reset test

3 weeks agosparse: Add archive_entry_sparse_reset test 3020/head
Tobias Stoeckmann [Tue, 28 Apr 2026 16:29:06 +0000 (18:29 +0200)] 
sparse: Add archive_entry_sparse_reset test

Check that archive_entry_sparse_reset resets all internal variables.

Test case created and issue reported by Linke Li.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 weeks agoMerge pull request #3016 from ZX41R/oss-fuzz-write-disk-secure-coverage
Tim Kientzle [Sat, 9 May 2026 21:12:56 +0000 (14:12 -0700)] 
Merge pull request #3016 from ZX41R/oss-fuzz-write-disk-secure-coverage

Improve write-disk fuzzer coverage

3 weeks agoMerge pull request #3015 from datauwu/master
Tim Kientzle [Sat, 9 May 2026 21:10:02 +0000 (14:10 -0700)] 
Merge pull request #3015 from datauwu/master

rar: avoid reading NEWSUB extended data during header parsing

3 weeks agoMerge pull request #2978 from stoeckmann/joliet_id_loop
Tim Kientzle [Sat, 9 May 2026 20:50:41 +0000 (13:50 -0700)] 
Merge pull request #2978 from stoeckmann/joliet_id_loop

iso9660: Fix infinite loop in Joliet ID generation

3 weeks agoMerge pull request #2928 from stoeckmann/anchor_no_flags
Tim Kientzle [Sat, 9 May 2026 20:49:25 +0000 (13:49 -0700)] 
Merge pull request #2928 from stoeckmann/anchor_no_flags

pathmatch: Treat anchors not special without flags

3 weeks agoMerge pull request #2927 from stoeckmann/pathmatch_recursion
Tim Kientzle [Sat, 9 May 2026 20:48:20 +0000 (13:48 -0700)] 
Merge pull request #2927 from stoeckmann/pathmatch_recursion

archive_match: Prevent call stack overflow

3 weeks agorar: limit and skip NEWSUB extended data 3015/head
Cris Jacob Maamor [Sat, 9 May 2026 19:31:37 +0000 (03:31 +0800)] 
rar: limit and skip NEWSUB extended data

Avoid requesting NEWSUB extended data through read-ahead while parsing the header. The full NEWSUB block size is still validated and consumed, but the extended data is not required to be present in memory during header parsing.

Add a test for a malformed NEWSUB header with a large packed size.

3 weeks agoMerge pull request #2930 from stoeckmann/mtree_option
Tim Kientzle [Sat, 9 May 2026 16:15:26 +0000 (09:15 -0700)] 
Merge pull request #2930 from stoeckmann/mtree_option

mtree: Fix time value parser truncation

3 weeks agoMerge pull request #2929 from stoeckmann/7zip_codec_id
Tim Kientzle [Sat, 9 May 2026 16:14:11 +0000 (09:14 -0700)] 
Merge pull request #2929 from stoeckmann/7zip_codec_id

7zip: Verify that Codec ID fits into 63 bit

3 weeks agoMerge pull request #2982 from stoeckmann/mtree_hex
Tim Kientzle [Sat, 9 May 2026 16:11:14 +0000 (09:11 -0700)] 
Merge pull request #2982 from stoeckmann/mtree_hex

mtree: Fix hex parser

3 weeks agoMerge pull request #2974 from stoeckmann/joliet_id
Tim Kientzle [Sat, 9 May 2026 16:10:07 +0000 (09:10 -0700)] 
Merge pull request #2974 from stoeckmann/joliet_id

iso9660: Fix OOB during Joliet ID generation

3 weeks agoMerge pull request #2969 from stoeckmann/glibc234
Tim Kientzle [Sat, 9 May 2026 15:58:28 +0000 (08:58 -0700)] 
Merge pull request #2969 from stoeckmann/glibc234

Fix build with glibc 2.43

4 weeks agoiso9660: Fix OOB in Joliet ID generation 2974/head
Tobias Stoeckmann [Tue, 21 Apr 2026 16:46:28 +0000 (18:46 +0200)] 
iso9660: Fix OOB in Joliet ID generation

Allocate enough memory for possible addition of 3 characters within the
range of 0-Z. Since UTF-16 is in use, allocate 6 bytes + 2 bytes for the
terminating NUL character.

Also keep in mind that "l" is already size in bytes, which means that a
multiplication of 2 is not needed (and prevented overflow issues with
longer filenames).

Resolves #2935.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agoiso9660: Add Joliet ID regression test
Tobias Stoeckmann [Tue, 21 Apr 2026 16:40:12 +0000 (18:40 +0200)] 
iso9660: Add Joliet ID regression test

It is possible to trigger an out of boundary write with short filenames
which contain illegal ISO9660 characters. For these files, Joliet IDs
are generated. If multiple files lead to the same ID (which can happen
because illegal characters are replaced with an underscore), 3
characters/digits in the range of 0-Z are added.

The addition could overflow the memory.

Based on PoC in #2935.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agomtree: Fix hex parser 2982/head
Tobias Stoeckmann [Sun, 26 Apr 2026 16:11:28 +0000 (18:11 +0200)] 
mtree: Fix hex parser

Digits a-f/A-F need an offset of 10.

Resolves #2975.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agoiso9660: Fix infinite loop in Joliet ID generation 2978/head
Tobias Stoeckmann [Tue, 21 Apr 2026 16:48:11 +0000 (18:48 +0200)] 
iso9660: Fix infinite loop in Joliet ID generation

3 characters/digits base 36 means that 46656 combinations are possible.
If a directory with even more conflicting identifiers is encountered, the
code would trigger an endless loop.

Fail with an error in such a case instead.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agoRemove const qualifier from modified strings 2969/head
Tobias Stoeckmann [Mon, 20 Apr 2026 15:44:46 +0000 (17:44 +0200)] 
Remove const qualifier from modified strings

Strings pointed to by these variables are actually modified. They point
to modifiable data areas (own stack arrays or argv arguments), so the
code does not erroneously modify them. Instead, clarify that they are
modifiable by removing the qualifier.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agoFix more handling of missing const type qualifiers
Tobias Stoeckmann [Mon, 20 Apr 2026 15:41:52 +0000 (17:41 +0200)] 
Fix more handling of missing const type qualifiers

Add missing const qualifier which otherwise triggers build errors
beginning with glibc 2.43.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agofix handling of missing const type qualifier
Rudi Heitbaum [Mon, 16 Feb 2026 10:20:04 +0000 (10:20 +0000)] 
fix handling of missing const type qualifier

Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
4 weeks agoDo not call parse_options with const
Rudi Heitbaum [Mon, 16 Feb 2026 10:15:46 +0000 (10:15 +0000)] 
Do not call parse_options with const

The data variable passed in to parse_option is modified and is passed
in as a strdup.

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
4 weeks agomtree: Fix time value parser truncation 2930/head
Tobias Stoeckmann [Wed, 18 Mar 2026 17:28:40 +0000 (18:28 +0100)] 
mtree: Fix time value parser truncation

The supplied nanoseconds of time keyword could be truncated due to
casting from int64_t to long (relevant for Windows and x86), resulting
in an incorrect value.

Since the implementation already caps the value at specific limits for
bug compatibility, just use the correct data type for parsing to not
make things worse.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks ago7zip: Verify that Codec ID fits into 63 bit 2929/head
Tobias Stoeckmann [Wed, 18 Mar 2026 17:18:08 +0000 (18:18 +0100)] 
7zip: Verify that Codec ID fits into 63 bit

According to 7zip standard, up to 15 bytes can be used for the Codec ID,
but not more than 63 bit shall be used (by today):

- Switch to uint64_t to avoid 32 bit unsigned long on Windows
- Verify that Codec ID parser does not overflow the integer

If the Codec ID does not fit, treat it as a file format error.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agoarchive_pathmatch: Anchors without flags regular 2928/head
Tobias Stoeckmann [Wed, 18 Mar 2026 15:37:41 +0000 (16:37 +0100)] 
archive_pathmatch: Anchors without flags regular

If no flags are supplied, anchor flags are supposed to be not special.
This means that ^ at the beginning of a pattern should be treated as a
regular character.

This breaks current behavior, but complies with comments in code, i.e.
archive_pathmatch.h line 41/42.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agoarchive_pathmatch: Extend unit tests
Tobias Stoeckmann [Wed, 18 Mar 2026 15:36:50 +0000 (16:36 +0100)] 
archive_pathmatch: Extend unit tests

Add some tests to clarify what happens in these cases. Also, this
increases test coverage.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agoread_disk: Set correct match error codes 2927/head
Tobias Stoeckmann [Wed, 18 Mar 2026 14:53:41 +0000 (15:53 +0100)] 
read_disk: Set correct match error codes

The errno value is not correct here. If the error string of a failed
match is printed, use also its error code.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agoarchive_match: Prevent call stack overflow
Tobias Stoeckmann [Wed, 18 Mar 2026 13:57:43 +0000 (14:57 +0100)] 
archive_match: Prevent call stack overflow

Patterns with a lot of asterisks may overflow the call stack, crashing
the application. Check the recursion depth. If it is too deep, fail
with an error.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agotools: Handle archive_match errors
Tobias Stoeckmann [Wed, 18 Mar 2026 13:55:56 +0000 (14:55 +0100)] 
tools: Handle archive_match errors

These functions can return negative values, in which case operation
itself failed. While internal libarchive libraries handle these cases,
the tools don't. Check for negative values in them as well.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agolibarchive: Fix typos in comments
Tobias Stoeckmann [Wed, 18 Mar 2026 13:53:32 +0000 (14:53 +0100)] 
libarchive: Fix typos in comments

"something error" -> "some error"

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks agoMerge pull request #3019 from kientzle/kientzle-sparse-uaf-012
Tim Kientzle [Sat, 9 May 2026 02:04:25 +0000 (19:04 -0700)] 
Merge pull request #3019 from kientzle/kientzle-sparse-uaf-012

[sparse] UAF in sparse_reset

4 weeks agoMerge pull request #3018 from tbkka/tbkka-mtree-null-deref-014
Tim Kientzle [Sat, 9 May 2026 02:03:11 +0000 (19:03 -0700)] 
Merge pull request #3018 from tbkka/tbkka-mtree-null-deref-014

[MTREE] NULL pointer deref during archive close

4 weeks ago[sparse] UAF in sparse_reset 3019/head
Tim Kientzle [Sat, 9 May 2026 01:48:45 +0000 (18:48 -0700)] 
[sparse] UAF in sparse_reset

4 weeks ago[MTREE] NULL pointer deref during archive close 3018/head
Tim Kientzle [Fri, 8 May 2026 23:35:52 +0000 (16:35 -0700)] 
[MTREE] NULL pointer deref during archive close

4 weeks agoMerge pull request #3017 from tbkka/tbkka-iso9660-015-019
Tim Kientzle [Fri, 8 May 2026 23:27:48 +0000 (16:27 -0700)] 
Merge pull request #3017 from tbkka/tbkka-iso9660-015-019

[ISO9660] Fix NULL deref and Joliet ID overflow

4 weeks agoAllow functions to be unused here 3017/head
Tim Kientzle [Fri, 8 May 2026 23:10:50 +0000 (16:10 -0700)] 
Allow functions to be unused here

4 weeks ago[ISO9660] Fix NULL deref and Joliet ID overflow
Tim Kientzle [Fri, 8 May 2026 22:41:18 +0000 (15:41 -0700)] 
[ISO9660] Fix NULL deref and Joliet ID overflow

4 weeks agoMerge pull request #3013 from tbkka/tbkka-xar-undefined-011-018
Tim Kientzle [Fri, 8 May 2026 22:40:05 +0000 (15:40 -0700)] 
Merge pull request #3013 from tbkka/tbkka-xar-undefined-011-018

[XAR] Fix two UB

4 weeks agoGeneralize code to run on Windows 3013/head
Tim Kientzle [Fri, 8 May 2026 22:23:06 +0000 (15:23 -0700)] 
Generalize code to run on Windows

4 weeks agoMerge pull request #2984 from tyler-yankee/cpio-hardlink-pathname-null
Tim Kientzle [Fri, 8 May 2026 17:16:29 +0000 (10:16 -0700)] 
Merge pull request #2984 from tyler-yankee/cpio-hardlink-pathname-null

cpio reader: Validate pathname in record_hardlink

4 weeks agoImprove write-disk fuzzer coverage 3016/head
ZX41R [Fri, 8 May 2026 13:50:26 +0000 (13:50 +0000)] 
Improve write-disk fuzzer coverage

4 weeks agocpio reader: Validate pathname in record_hardlink 2984/head
Tyler Yankee [Sun, 26 Apr 2026 22:35:24 +0000 (18:35 -0400)] 
cpio reader: Validate pathname in record_hardlink

Prevent null pointer dereference and heap-use-after-free when
processing CPIO archives with hardlink entries that lack pathname
information.

4 weeks agoMerge pull request #3014 from kientzle/kientzle-test_utils-ub
Tim Kientzle [Fri, 8 May 2026 05:20:19 +0000 (22:20 -0700)] 
Merge pull request #3014 from kientzle/kientzle-test_utils-ub

[test_utils] Fix a minor UB

4 weeks ago[7zip] Another shift UB caused by integer promotion 3014/head
Tim Kientzle [Fri, 8 May 2026 05:04:20 +0000 (22:04 -0700)] 
[7zip] Another shift UB caused by integer promotion

4 weeks ago[test_utils] Fix a minor UB
Tim Kientzle [Fri, 8 May 2026 04:50:50 +0000 (21:50 -0700)] 
[test_utils] Fix a minor UB

(UBSan occasionally finds something interesting and
often reports whacky non-bugs like this one. "Fixing"
it will make the real UB bugs easier to identify, so...)

According to C's integer promotion rules, `unsigned short` gets
promoted to _signed_ `int`, and shifting into the sign bit of an `int`
is technically UB.  Explicit cast to `unsigned` quiets UBSan.

4 weeks agoMerge pull request #3012 from tbkka/tbkka-pathmatch-buffer-overread-003
Tim Kientzle [Fri, 8 May 2026 04:40:10 +0000 (21:40 -0700)] 
Merge pull request #3012 from tbkka/tbkka-pathmatch-buffer-overread-003

[pathmatch] Heap buffer over-read

4 weeks agoInclude missing file
Tim Kientzle [Fri, 8 May 2026 04:37:08 +0000 (21:37 -0700)] 
Include missing file

4 weeks agoMerge pull request #3011 from tbkka/tbkka-tar-acl-oob-002
Tim Kientzle [Fri, 8 May 2026 04:31:14 +0000 (21:31 -0700)] 
Merge pull request #3011 from tbkka/tbkka-tar-acl-oob-002

[ACL] Parser out-of-bounds read

4 weeks ago[XAR] Fix two UB
Tim Kientzle [Fri, 8 May 2026 04:11:54 +0000 (21:11 -0700)] 
[XAR] Fix two UB

1. The XAR writer's path normalization code uses strcpy() to move
   parts of a path string within the same buffer. The source and
   destination ranges overlap, which is undefined behavior for strcpy().

2. Failure to check string length before accessing the last character
   of a path component. For empty components (e.g., //), the length is 0,
   and length-1 underflows to SIZE_MAX.

4 weeks ago[pathmatch] Heap buffer over-read 3012/head
Tim Kientzle [Fri, 8 May 2026 03:15:37 +0000 (20:15 -0700)] 
[pathmatch] Heap buffer over-read

The bracket expression matching [ in the pathmatch engine fails to
handle malformed patterns, specifically when a closing ] is missing or
when high-byte characters are used. The scanner advances the pattern
pointer beyond the allocated buffer.

4 weeks agoMerge pull request #3008 from jlduran/fix-root-mtree
Tim Kientzle [Fri, 8 May 2026 02:52:41 +0000 (19:52 -0700)] 
Merge pull request #3008 from jlduran/fix-root-mtree

mtree: Do not append '/' when basename is '.'

4 weeks ago[ACL] Parser out-of-bounds read 3011/head
Tim Kientzle [Fri, 8 May 2026 02:41:04 +0000 (19:41 -0700)] 
[ACL] Parser out-of-bounds read

The ACL parser fails to validate buffer length when processing PAX
attributes (SCHILY.acl.access/default). The next_field() function
attempts to read a separator character from a pointer even when the
remaining length is zero.

Reported-by: Kamil Frankowicz
4 weeks agoMerge pull request #3010 from kientzle/kientzle-overlarge-dates
Tim Kientzle [Fri, 8 May 2026 01:21:00 +0000 (18:21 -0700)] 
Merge pull request #3010 from kientzle/kientzle-overlarge-dates

Date parsing: reject dates with numbers of more than 4 digits

4 weeks agoFix build error 3010/head
Tim Kientzle [Fri, 8 May 2026 00:50:07 +0000 (17:50 -0700)] 
Fix build error

4 weeks agomtree: Do not append '/' when basename is '.' 3008/head
Jose Luis Duran [Wed, 15 Apr 2026 01:36:07 +0000 (01:36 +0000)] 
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

4 weeks agoDate parsing: reject date components with numbers of more than 4 digits
Tim Kientzle [Thu, 7 May 2026 21:35:02 +0000 (14:35 -0700)] 
Date parsing: reject date components with numbers of more than 4 digits

Only the Unix epoch format `@<timestamp>` can have a number with
more than 4 digits.  So let's break out the numeric parsing into
a standalone uint64 parser and use it separately to parse epoch
timestamps (which are only limited by the range of time_t) and
other date components.

It also avoids a time-consuming leap-year correction for
nonsensically large year values.

4 weeks agoMerge pull request #3009 from kientzle/archive-read-sticky-fatal
Tim Kientzle [Thu, 7 May 2026 19:41:30 +0000 (12:41 -0700)] 
Merge pull request #3009 from kientzle/archive-read-sticky-fatal

Minor cleanups from #2298

4 weeks agoCleanup a new test, fill in some missing assertions 3009/head
Tim Kientzle [Thu, 7 May 2026 19:25:58 +0000 (12:25 -0700)] 
Cleanup a new test, fill in some missing assertions

4 weeks agoMerge pull request #2998 from kientzle/archive-read-sticky-fatal
Tim Kientzle [Thu, 7 May 2026 19:19:02 +0000 (12:19 -0700)] 
Merge pull request #2998 from kientzle/archive-read-sticky-fatal

archive_read: FATAL should be sticky for all API calls

4 weeks agoTODO seems to have been addressed; remove
Tim Kientzle [Thu, 7 May 2026 16:45:17 +0000 (09:45 -0700)] 
TODO seems to have been addressed; remove

4 weeks agoMerge pull request #3007 from jlduran/escape-vis-glob-chars
Tim Kientzle [Thu, 7 May 2026 15:34:11 +0000 (08:34 -0700)] 
Merge pull request #3007 from jlduran/escape-vis-glob-chars

mtree: Escape standard pathname matching characters

4 weeks agomtree: Escape standard pathname matching characters 3007/head
Jose Luis Duran [Wed, 15 Apr 2026 04:00:16 +0000 (04:00 +0000)] 
mtree: Escape standard pathname matching characters

Escape all strsvis(3) VIS_GLOB matching characters ('*', '?', '[', or
'#').

4 weeks agoRestore verbosity
Tim Kientzle [Thu, 7 May 2026 06:25:10 +0000 (23:25 -0700)] 
Restore verbosity

4 weeks agoFix CMake style
Tim Kientzle [Thu, 7 May 2026 06:24:53 +0000 (23:24 -0700)] 
Fix CMake style

4 weeks agoRestore switch_multivolume as needed 2998/head
Tim Kientzle [Thu, 7 May 2026 06:16:57 +0000 (23:16 -0700)] 
Restore switch_multivolume as needed

4 weeks agoAdjust tests
Tim Kientzle [Thu, 7 May 2026 05:15:11 +0000 (22:15 -0700)] 
Adjust tests

4 weeks agoFix CMake-based testing
Tim Kientzle [Thu, 7 May 2026 05:02:15 +0000 (22:02 -0700)] 
Fix CMake-based testing

4 weeks agoMake default test output verbose, for better CI info
Tim Kientzle [Thu, 7 May 2026 01:54:31 +0000 (18:54 -0700)] 
Make default test output verbose, for better CI info

4 weeks agoMerge pull request #3006 from stoeckmann/7zip_32
Tim Kientzle [Wed, 6 May 2026 18:52:11 +0000 (11:52 -0700)] 
Merge pull request #3006 from stoeckmann/7zip_32

7zip: Fix 32 bit heap overflow

4 weeks ago7zip: Fix more 32 bit truncations 3006/head
Tobias Stoeckmann [Mon, 27 Apr 2026 16:08:46 +0000 (18:08 +0200)] 
7zip: Fix more 32 bit truncations

Check for truncations before casting uint64_t to size_t for 32 bit
system safety.

Reported by Asaf Meizner.
Resolves additional notes in GHSA-rf5v-vf7c-6wvg.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 weeks ago7zip: Fix 32 bit heap overflow
Asaf Meizner [Mon, 27 Apr 2026 15:56:35 +0000 (17:56 +0200)] 
7zip: Fix 32 bit heap overflow

Prevent an unsufficient memory allocation on 32 bit systems by checking
if a uint64_t value actually fits into size_t.

Resolves GHSA-rf5v-vf7c-6wvg.

4 weeks agoMerge branch 'master' into archive-read-sticky-fatal
Tim Kientzle [Wed, 6 May 2026 16:28:05 +0000 (09:28 -0700)] 
Merge branch 'master' into archive-read-sticky-fatal

4 weeks agoMerge pull request #3005 from kientzle/kientzle-automatic-test-discovery
Tim Kientzle [Wed, 6 May 2026 04:23:54 +0000 (21:23 -0700)] 
Merge pull request #3005 from kientzle/kientzle-automatic-test-discovery

[CMake] Automatically update `list.h`

4 weeks ago[CMake] Automatically update `list.h` 3005/head
Tim Kientzle [Wed, 6 May 2026 03:54:12 +0000 (20:54 -0700)] 
[CMake] Automatically update `list.h`

`list.h` contains a list of all the tests and is generated
by grepping the test source files for `DEFINE_TEST`.
Previously, it was generated at configure time.
This meant that if you added a new test to an existing
source file, you had to manually reconfigure.

This adds the necessary dependencies so that `list.h`
is regenerated whenever any C test source changes.
This ensures that new tests are always discovered automatically.

Note:  If someone wants to update the autoconf-based
build system to do this, please send a PR.

4 weeks agoMerge pull request #3000 from kientzle/kientzle-cab-hardening
Tim Kientzle [Wed, 6 May 2026 01:35:33 +0000 (18:35 -0700)] 
Merge pull request #3000 from kientzle/kientzle-cab-hardening

[CAB] Harden the handling of invalid headers

4 weeks agoMerge pull request #3004 from kientzle/kientzle-rar5-bad-tables
Tim Kientzle [Wed, 6 May 2026 01:34:22 +0000 (18:34 -0700)] 
Merge pull request #3004 from kientzle/kientzle-rar5-bad-tables

[RAR5] FAIL if the decode table is > 2^16

4 weeks agoRemove unused var 3004/head
Tim Kientzle [Wed, 6 May 2026 01:20:10 +0000 (18:20 -0700)] 
Remove unused var

4 weeks agoSolid archives cannot recover from a failed entry
Tim Kientzle [Wed, 6 May 2026 01:03:28 +0000 (18:03 -0700)] 
Solid archives cannot recover from a failed entry

4 weeks ago[RAR5] FAIL if the decode table is > 2^16
Tim Kientzle [Tue, 5 May 2026 22:43:48 +0000 (15:43 -0700)] 
[RAR5] FAIL if the decode table is > 2^16

4 weeks agoMerge pull request #3002 from kientzle/7zip-setup-decode-folder-state-order
Tim Kientzle [Tue, 5 May 2026 22:21:50 +0000 (15:21 -0700)] 
Merge pull request #3002 from kientzle/7zip-setup-decode-folder-state-order

[7zip] Clean up the failure path in `setup_decode_folder`

4 weeks agoMerge pull request #3003 from kientzle/kientzle-test-runner-name-args
Tim Kientzle [Tue, 5 May 2026 22:21:25 +0000 (15:21 -0700)] 
Merge pull request #3003 from kientzle/kientzle-test-runner-name-args

Clarify the test harness usage

4 weeks agoClarify the test harness usage 3003/head
Tim Kientzle [Tue, 5 May 2026 21:45:26 +0000 (14:45 -0700)] 
Clarify the test harness usage

4 weeks ago[7zip] Clean up the failure path in `setup_decode_folder` 3002/head
Tim Kientzle [Tue, 5 May 2026 21:12:15 +0000 (14:12 -0700)] 
[7zip] Clean up the failure path in `setup_decode_folder`

As noted by @dunhor, the logic here was a little unclear.
Reorganize to do all the checks, then set up the decode
parameters only if the checks pass.

This has no functional change, it's just a legibility improvement.

4 weeks ago[RAR5] Correct handling of unknown filter types
Tim Kientzle [Tue, 5 May 2026 17:00:01 +0000 (10:00 -0700)] 
[RAR5] Correct handling of unknown filter types

The change to return FAILED for entry-specific issues uncovered
flaws in RAR5 handling of filter types:
* Supported filter types are verified in `parse_filter` and
  were being also checked in `run_filter` -- the duplication
  confused the error handling here.
* `do_uncompress_file` was only checking for `FATAL` from
  the upstream filter logic, so failed to properly pass
  `FAILED` errors through

4 weeks ago[rar5] Fix infinite loop in header parsing
Tim Kientzle [Mon, 4 May 2026 23:38:15 +0000 (16:38 -0700)] 
[rar5] Fix infinite loop in header parsing

The change to return `FAILED` instead of `FATAL` for issues that
impact a single entry (but don't necessarily terminate the entire archive)
created a bug in header parsing since `FAILED` wasn't handled in a
header-check loop.

Thank goodness for fuzzing CI!

4 weeks ago7zip: propagate skip_stream's actual error code in read_data_skip
Tim Kientzle [Mon, 4 May 2026 03:42:22 +0000 (20:42 -0700)] 
7zip: propagate skip_stream's actual error code in read_data_skip

archive_read_format_7zip_read_data_skip used to coerce any negative
skip_stream() return into ARCHIVE_FATAL.  That is wrong in principle:
ARCHIVE_FAILED can legitimately propagate up from setup_decode_folder()
through read_stream() and skip_stream(), and the wrapper should not
upgrade it.

In the current encryption-partially test case this is empirically a
no-op because skip_stream() still returns ARCHIVE_FATAL via a second,
deeper code path through extract_pack_stream().  An inline TODO comment
flags that asymmetry for a follow-up audit.

4 weeks agorar5: convert remaining per-entry data errors to ARCHIVE_FAILED
Tim Kientzle [Mon, 4 May 2026 03:12:42 +0000 (20:12 -0700)] 
rar5: convert remaining per-entry data errors to ARCHIVE_FAILED

Follow-up to 9fa772ab.  An audit of the rar5 reader found many more
ARCHIVE_FATAL returns in data-decode paths that should be ARCHIVE_FAILED
so the caller can move on to the next entry after a corrupt one:

  apply_filters       Unsupported filter type
  parse_tables        Truncated huffman tables, decode failures (8 sites)
  parse_block_header  Unsupported header size, block checksum error
  do_uncompress_block Decode code length / distance slot failures
                      Distance pointer overflow
                      decode_number / decode_code_length failures
  merge_block         Block size == 0 during merge
  do_uncompress_file  Invalid window size declaration
  verify_checksums    CRC32 / BLAKE2 mismatch

Programmer assertions, ENOMEM, true I/O errors, and propagation of
copy_string's window-buf-NULL FATAL return are intentionally kept as
ARCHIVE_FATAL because they are not recoverable per-entry conditions.

4 weeks agorar: convert remaining per-entry data errors to ARCHIVE_FAILED
Tim Kientzle [Sun, 3 May 2026 23:25:55 +0000 (16:25 -0700)] 
rar: convert remaining per-entry data errors to ARCHIVE_FAILED

Follow-up to 4f148608.  A code review found additional ARCHIVE_FATAL
returns in RAR4 data-decode paths that should be ARCHIVE_FAILED so the
caller can move on to the next entry:

  read_data_block      Truncated RAR file data
  read_data_compressed PPMd "Invalid symbol" (3 sites)
  parse_codes          Zero window size is invalid
  add_value            Prefix found (second site)
  make_table_recurse   Huffman tree was not created
  make_table_recurse   Invalid location to Huffman tree specified

These are all per-entry parse/decode failures.  As with the earlier
batch, the rar4 input position is tracked by rar_br_fillup so
read_data_skip will correctly advance past the damaged entry, and
RAR4 solid mode is not supported, so subsequent entries are not at
risk from a half-consumed shared decoder state.