94 Commits
Author SHA1 Message Date
datauwu 86a88b9edf archive_write: share hdrcharset option handling
Several archive writers duplicate identical hdrcharset option handling.
Share the validation and conversion logic across the affected cpio, tar,
and zip writers.

This reduces duplication without changing behavior.
2026-08-03 16:53:58 +08:00
datauwu c84de7963c warc: fix UB signed overflow in time conversion
Use checked 64-bit math when timegm() is not available.
Reject values outside time_t instead of overflowing signed integers.
2026-08-02 03:04:20 +08:00
datauwu 535360bfeb warc: test future date conversion
Add a WARC date after 2038 to cover the fallback time conversion.
On 64-bit time_t, it must parse as the expected Unix timestamp.
2026-08-02 02:57:01 +08:00
datauwu 0da2e229b1 bsdtar: fix UB signed overflow in time formatting
Use difftime() instead of changing time_t values by the half-year
range. This avoids signed overflow near the time_t limits without
changing normal output.
2026-08-01 19:48:39 +08:00
datauwu efa19ce699 bsdcpio: fix UB signed overflow in time formatting
Use difftime() instead of subtracting time_t values when choosing the
date format. This avoids signed overflow for far past or future
timestamps without changing normal output.
2026-08-01 19:48:38 +08:00
datauwu fcf3d40b3b archive_string: require localcharset.h for locale_charset
Only call locale_charset() when localcharset.h provides its declaration.
2026-07-30 16:20:51 +08:00
datauwu a96851a161 warc: name local variables
Replace short local names with clear names.

Match the common writer layout and return style.
2026-07-27 17:30:52 +08:00
datauwu a1f1de994e warc: name helper functions
Give private helpers clear WARC names.

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

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

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

The active state is freed by archive_read_close(), while the bidder state
remains valid until archive_read_free(). This keeps archive_filter_name()
from returning a dangling pointer.
2026-07-22 03:12:04 +08:00
datauwu 6cab05dbd5 program: test filter name after close
Verify that the external program filter name remains available after
archive_read_close().
2026-07-22 03:12:04 +08:00
datauwu b76db24481 xar: use strrchr to find parent directories
Replace the manual pathname scan with strrchr when locating the
parent directory.
2026-07-21 17:43:15 +08:00
datauwu 2a8a284212 mtree: use strrchr to find parent directories
Replace the manual pathname scan with strrchr when locating the
parent directory.
2026-07-21 17:43:15 +08:00
datauwu 4a448d488c mtree: use archive_string_dirname to roll back paths
Replace the manual reverse scan with archive_string_dirname while
preserving the empty path representation.
2026-07-21 17:43:14 +08:00
datauwu b15a0a0bb5 iso9660: remove per-reader zero comparison buffer
Check reserved fields by comparing adjacent bytes after confirming the
first byte is zero. This preserves the memcmp fast path and removes
2 KiB from each ISO9660 reader state.
2026-07-21 17:07:05 +08:00
datauwu 402d829d2f warc: reject truncated file data
Return ARCHIVE_FATAL when EOF is reached before Content-Length.
2026-07-20 01:35:04 +08:00
datauwu 9fa66d8fe0 warc: test truncated file data
Verify that a body shorter than Content-Length is rejected.
2026-07-20 01:25:10 +08:00
datauwu 888d25b754 pax: use memcpy for known-length path components
Use memcpy() for path components whose lengths are already known and
write the terminating null byte explicitly.

Cache the inserted component length instead of calculating it multiple
times while constructing the ustar pathname.
2026-07-19 18:01:44 +08:00
datauwu 70a04a84cc ar: use strrchr for member filenames
Replace the single-use basename helper with strrchr() and preserve the
existing rejection of pathnames ending in a slash.

Cache the member filename length to avoid repeated strlen() calls while
building and writing the archive header.
2026-07-19 18:01:44 +08:00
datauwu e9fcf44e02 rar: avoid rescanning converted path separators
Continue searching after each replaced backslash instead of restarting
from the beginning of the filename.

This avoids repeatedly scanning the already converted prefix.
2026-07-19 12:15:48 +08:00
datauwu 3cc1738058 lha: use memchr to validate filenames
Replace the bytewise filename scan with memchr() when checking for the
invalid 0xff byte.

The search remains bounded by the filename length.
2026-07-19 03:07:34 +08:00
datauwu 5cb553dbcb xar: fix NULL dereference on allocation failure
Check the allocation used to initialize cur_dirstr before accessing the
buffer.

Release the partially initialized strings, root entry, file registry,
and hardlink registry before returning ARCHIVE_FATAL.
2026-07-19 00:28:32 +08:00
datauwu 5a822798ff tar: fix UAF when reading GNU sparse headers
Copy the old GNU tar header before reading sparse extension blocks.

Those reads may replace or free the callback buffer backing the original
header. Use the copy when parsing the common header fields.
2026-07-18 23:31:40 +08:00
datauwu ee5715fc82 zip: remove redundant helper
Calculate the pathname length directly after validating the path.

The helper only wrapped strlen() and adjusted the length for directory
entries. Removing it keeps the calculation beside the validation and
reuses the existing file type value.
2026-07-18 19:19:45 +08:00
datauwu dc81f68c6f tar: add GNU sparse header buffer reuse test
Add a test archive that reuses one read buffer for every 512-byte block.

Reading the sparse extension overwrites the main GNU header. Check that
mode, uid, gid, and mtime still come from the original header.
2026-07-18 15:48:44 +08:00
datauwu 17fc2be73a bsdtar: remove tar_i64toa()
Format integer values directly at each call site and remove the custom
integer formatter.

This handles the full signed integer range and preserves unsigned byte
counters.
2026-07-18 02:09:50 +08:00
datauwu 975ea4dbd9 archive_write: fix UAF when switching formats
Clear format state and callbacks after running the previous format
destructor so a failed replacement setup cannot leave stale pointers.

Also unregister previous GNU tar state and require ARCHIVE_STATE_NEW
before switching to GNU tar.
2026-07-18 01:27:25 +08:00
datauwu 9c805a24ea archive_write: test format switch UAF cleanup
Test that unregistering 7-Zip and XAR clears format state and is safe
to repeat.

Also test switching from 7-Zip to GNU tar and selecting GNU tar again.
2026-07-18 00:05:01 +08:00
datauwu 9b1746f63a xar: clean xattr checksum on encoder setup failure
Finalize the remaining xattr checksum context if encoder setup fails.
2026-07-15 22:34:03 +08:00
datauwu c318e8fac6 xar: clean xattr checksums on heap allocation failure
Finalize xattr checksum contexts if the xattr heap allocation fails.
2026-07-15 22:34:02 +08:00
datauwu 8abb31c630 xar: free virtual files on tree insert failure
Free both unlinked files when virtual-parent name generation fails.
2026-07-15 22:34:02 +08:00
datauwu 2c0d2c259e xar: clean checksums on encoder setup failure
Finalize both file checksum contexts if encoder setup fails after init.
2026-07-15 22:34:02 +08:00
datauwu 2fc84234cf xar: free write file on utility-name failure
Free the pending write file when utility name generation fails early.
2026-07-15 22:34:01 +08:00
datauwu d8040bff17 xar: free new read file when heap insertion fails
Restore the parent and free the unqueued file after heap insertion fails.
2026-07-15 22:34:01 +08:00
datauwu 2baeb07843 xar: free current read file on entry string ENOMEM
Free the popped xar_file before returning on metadata-copy ENOMEM.
2026-07-15 22:34:01 +08:00
datauwu c9e90b0ba7 tar: prefer multibyte pathname for AppleDouble checks
AppleDouble detection only needs to inspect the final path component for
the "._" prefix.

Check the multibyte pathname first on all platforms and only fall back to
WCS when the multibyte pathname is unavailable. This avoids unnecessary
wide-character pathname conversion for ordinary tar entries when mac-ext
handling is enabled.

Entries without an available pathname now return no match instead of
ARCHIVE_FAILED from the boolean check.
2026-07-14 16:59:06 +08:00
datauwu 4291ca15b1 warc: clarify resource header size error
Use a more specific error when resource header generation fails.

The old message said `cannot archive file`, but this path fails when
the generated WARC resource header exceeds the internal limit.
2026-07-13 16:52:33 +08:00
datauwu aeee33085d warc: propagate generated header errors
Check generated WARC header creation and writes.

Fail when the generated warcinfo header cannot be built. Treat a
resource header build failure as fatal because output may already exist.

Propagate write errors instead of marking the record as written.
2026-07-13 16:52:31 +08:00
datauwu aefecf2fc2 warc: test generated header write errors
Add memory-writer tests for generated WARC header write failures.

Cover both the warcinfo header and a resource header with warcinfo
disabled. These tests show that header write failures are hidden.
2026-07-13 16:52:25 +08:00
datauwu 43bb153a65 uu: fix null pointer UB in EOF buffering
The uu filter can keep a partial encoded line in its internal input
buffer, then reach upstream EOF with no new bytes available. In that
case, d is NULL and avail_in is zero, but the buffered-input path still
passes d to memcpy() before processing the saved bytes.

Skip the append copy when avail_in is zero so the saved input is handled
without passing a null source pointer to memcpy().
2026-07-12 22:04:12 +08:00
datauwu e87311a9a7 warc: reject incomplete resource records
Reject resource records when less data was written than Content-Length.

Do not append the WARC end marker after a short entry. Return fatal
because the record body has already been started.

This avoids writing a record whose length does not match its body.
2026-07-11 20:16:39 +08:00
datauwu 2e35365462 warc: test incomplete resource records
Add a writer test for a resource entry shorter than Content-Length.

The test closes after a short write and checks for a fatal error. It
documents that the end marker must not hide a short body.
2026-07-11 20:16:24 +08:00
datauwu ca8044d3c4 warc: modernize writer comments
Rewrite WARC writer comments to use clearer wording and consistent
terminology.

Keep the change comment-only while preserving existing behavior.
2026-07-11 16:47:24 +08:00
datauwu eb6fc941b8 warc: modernize reader comments
Rewrite WARC reader comments to use clearer wording and match the
style used by other libarchive format readers.

Keep the change comment-only while preserving existing behavior.
2026-07-11 16:47:23 +08:00
datauwu 23b54da0ba cpio: fix read-ahead pointer lifetime issue
Cache the CPIO trailer-name check before consuming the pathname
buffer.

The reader kept a pointer returned by __archive_read_ahead() and used
it after __archive_read_consume(), and after possible symlink body
processing. Read-ahead pointers are views into libarchive input buffers
and should not be relied on after the associated bytes are consumed.

Store the TRAILER!!! decision while the pathname buffer is still valid,
then use the saved boolean after the remaining header handling.
2026-07-11 12:11:53 +08:00
datauwu 9fcb4048fa warc: parse Content-Length as a bounded field
Parse Content-Length only up to the located end-of-line instead of
passing a bounded header field to strtol(). Use int64_t for the parsed
entry size, ASCII digit checks, and checked arithmetic while accumulating
the value.
2026-07-11 02:08:05 +08:00
datauwu 2854735c80 tests: fix signed left-shift UB in fuzz consumer
Fix i64 construction by using a uint64_t accumulator.
2026-07-10 21:35:35 +08:00
datauwu 27c56a53d5 pax: fix signed-char left-shift UB in base64 encoder
Fix base64 shifts by casting input bytes to unsigned.
2026-07-10 21:35:35 +08:00
datauwu 342d2728d3 rar: fix signed left-shift UB in audio filter
Fix signed audio delta scaling by using multiplication.
2026-07-10 21:35:35 +08:00
datauwu 801b9707c3 7zip: fix negative shift count in x86 BCJ filter
Fix the previous-position shift count before updating the mask.
2026-07-10 21:35:35 +08:00
datauwu 0046f16644 iso9660: fix 1-byte OOB read in iso-level option
iso9660_options() checks the second byte of the iso-level option value
before checking that the first byte contains a valid ISO level.

For an empty option value such as iso9660:iso-level=,
archive_write_set_options() passes a value pointer to the terminating NUL
byte of the duplicated options string. Reading value[1] then reads one byte
past that heap allocation.

Check value[0] before reading value[1]. This keeps the same accepted values
while rejecting the empty value without reading past the option buffer.
2026-07-08 20:24:33 +08:00
datauwu 51287cecd6 pax: fix 1-byte OOB read in sparse name building
The GNU sparse name builder trims trailing slash and /. components before
building the synthetic ustar entry name. If the sparse pathname is fully
pruned, the effective source length becomes zero and build_ustar_entry_name()
reads one byte before the pathname buffer.

Handle the all-pruned pathname case before calling the ustar name builder.
The synthetic name then preserves the root-directory case.
2026-07-08 18:10:27 +08:00
datauwu 0053ea743f bsdtar: fix 1-byte OOB read in substitution handling
The -s replacement scanner consumes a backslash and then reads the
escaped byte. If the replacement ends in one literal backslash, the loop
can advance past the terminating NUL and read one byte past the
allocated replacement buffer.

Stop scanning when a backslash is followed by the terminating NUL. The
final literal append then preserves the trailing backslash.
2026-07-07 21:58:54 +08:00
datauwu c81bc7eee8 zip: fix 1-byte OOB read in Mac extension check
The seekable ZIP reader checks whether __MACOSX/ entries are resource
fork entries by testing the basename prefix.

The existing guard used r - name, which is the basename offset from the
start of the filename, not the basename length. For a short basename such
as "__MACOSX/.", this could read one byte past the filename.

Check the remaining basename length before reading the resource fork prefix.
2026-07-07 20:36:24 +08:00
datauwu 2f0e327d12 warc: fix pending data when skipping entries
Consume pending data before EOF and skip handling.

Then skip only the unread body bytes plus the WARC record separator.
This keeps the reader at the correct input position after an entry has
been partially or fully read.
2026-07-07 08:14:38 +08:00
datauwu bd0cae0be7 iso9660: fix 1-byte OOB read in directory scanning
read_children() checked the directory record length byte before ensuring
that the record pointer was still inside the current logical block.

If directory records exactly filled the final block, the next loop
condition could read one byte past the image buffer.

Check the remaining block length before reading the record length byte.
2026-07-07 08:07:59 +08:00
datauwu f93abd161e tar: fix 1-byte OOB read in number parsing
tar_atol_base_n() read the next byte before checking whether any bytes
remained. If a numeric field ended at the caller-provided boundary, this
caused a 1-byte OOB read while preparing the next digit range check.

Read each digit only while bytes remain.
2026-07-06 22:51:18 +08:00
datauwu 40b92de1de tar: fix 1-byte OOB read in SUN.holesdata parsing
header_pax_extension() passes PAX attribute values without the trailing
newline to pax_attribute(). The SUN.holesdata parser read one byte past
the supplied value when the last numeric field ended at the value
boundary.

Handle length == 0 before checking *e.
2026-07-06 21:51:15 +08:00
datauwu 172e463c41 warc: add test for skipping after extraction
Add a test that extracts data from the first WARC resource record, then
moves to the second header.

This checks the bug where already-read entry data was not handled correctly
before skip handling.
2026-07-06 16:15:05 +08:00
datauwu 467d31b0cf zip: read PKWARE Unix extra field metadata
Read the fixed metadata prefix of the PKWARE Unix extra field 0x000d.

The fixed portion contains atime, mtime, uid, and gid values. Require
the full 12-byte prefix before reading it, and leave the variable-length
data field unsupported for now.
2026-07-05 13:27:29 +08:00
datauwu 9a2087f9d7 zip: test PKWARE Unix extra field
Add a test for the PKWARE Unix extra field 0x000d.

The fixture stores a regular file with the 12-byte fixed metadata
prefix in both the local header and central directory. The test checks
that the ZIP reader exposes mtime, atime, uid, and gid metadata for
seekable and streaming reads.
2026-07-05 13:22:03 +08:00
datauwu 3a2538bca3 warc: require file size before writing header
WARC records require a known Content-Length. Reject regular file
entries without a valid size instead of treating them as zero.
Avoid casting archive_entry_size() through size_t before storing it in
the uint64_t WARC Content-Length field, since that can truncate large
sizes on 32-bit platforms.
2026-07-05 03:11:15 +08:00
datauwu 366baca718 warc: test missing file size handling
Add coverage for WARC entries without a known size. The writer
must reject these entries because WARC requires Content-Length.
2026-07-05 01:26:57 +08:00
datauwu 9c5210e8a5 pax: remove redundant hardlink size assignment
archive_write_pax_header() set hardlink entries to size zero for the
restricted pax format, then immediately set all hardlink entries to size
zero again.

Remove the narrower check because it is fully subsumed by the following
hardlink check.

No functional change intended.
2026-07-04 13:57:33 +08:00
datauwu 426f2aef86 tar: avoid parsing mode field twice
header_common() parsed the tar mode field once when setting the file
type and again when setting permissions. Cache the parsed value and reuse
it for both setters.

archive_entry_set_filetype() and archive_entry_set_perm() already mask
the relevant bits, so passing the full header mode preserves behavior.
The permission-set guard is unchanged.

No functional change intended.
2026-07-04 13:57:32 +08:00
datauwu fbad49b708 7zip: skip ArchiveProperties payload data
ArchiveProperties entries have a property ID, a size, and payload.

The reader parsed the ID and size, but did not consume the payload.
Payload bytes could then be read as the next property ID, which
misaligned the rest of header parsing.

Skip the payload in chunks so parsing stays aligned with 7-Zip/7zz.
2026-07-04 12:00:07 +08:00
datauwu 49a273e314 7zip: add ArchiveProperties payload test
Add a 7z test archive with a non-empty ArchiveProperties payload.

The archive has one empty file and an ArchiveProperties entry with a
1-byte payload. It is accepted by 7-Zip/7zz.

This covers parsing when ArchiveProperties has payload bytes.
2026-07-04 01:44:58 +08:00
datauwu 1c6e7b491f zip: avoid signed overflow in encrypted size checks
Avoid adding the encryption overhead directly to entry sizes when deciding
whether Zip64 is needed or when updating the stored compressed size.

For the Zip64 decision, compare against ZIP_4GB_MAX - additional_size. For
stored encrypted entries, use archive_ckd_add_i64() so the size update and
overflow check happen together.
2026-07-03 23:48:50 +08:00
datauwu a32e870da4 7zip: skip fully-defined metadata bitmaps
Avoid allocating and filling metadata bitmaps when the 7z header says
that every file has the corresponding value.

Sparse metadata still uses the existing bitmap path.
2026-07-03 08:24:15 +08:00
datauwu e42a14d5e7 write: remove unused zip and warc fields
Remove writer fields that are initialized but never read.
2026-07-02 21:44:48 +08:00
datauwu 1a98844466 rar5: remove unused filter_info fields
Remove filter_info fields that are never assigned or read.
2026-07-02 21:44:48 +08:00
datauwu c5f1dba4e3 rar: remove unused globalbackup fields
Remove RAR filter backup fields that are never used.
2026-07-02 21:44:48 +08:00
datauwu f12b3fe00c cab: remove unused LZX tree_used state
Remove LZX Huffman state that is reset but never read.
2026-07-02 21:44:48 +08:00
datauwu ebe53f5fcd cab: remove unused header and entry fields
Remove CAB fields that are parsed or reset but never read.
2026-07-02 21:44:48 +08:00
datauwu 4f9f341f16 zip: remove unused central directory counters
Remove counters that are initialized or incremented but never read.
2026-07-02 21:40:07 +08:00
datauwu 5cd808a44b 7zip: simplify metadata bool handling
Flatten nested allAreDefined checks for attribute and timestamp bools.

Also initialize empty-stream entries as directories by default before
applying the optional EmptyFile bitmap.

No archive behavior change is intended.
2026-07-01 23:10:46 +08:00
datauwu 86fd6c20c0 7zip: drop redundant BCJ2 assignments
Both supported BCJ2 layout branches store the chosen unpack size in
remaining.

main_stream_bytes_remaining is set from remaining immediately after
the branch, so the earlier assignments are redundant.
2026-07-01 22:56:30 +08:00
datauwu 5782aa72cd 7zip: remove unused writer byte counters
The 7z writer kept compressed and uncompressed byte counters that were
updated after each entry but never read.

Remove the counters and their updates.
2026-07-01 17:38:25 +08:00
datauwu aabed78710 7zip: fix SFX boundary checks
The SFX scanner missed a valid 7-Zip header when exactly 32 bytes
remained in the lookahead buffer.

The ELF SFX path also missed ".data" when it was at the last valid
position in the section string table. It also allowed e_shstrndx to be
equal to e_shnum, even though that is one past the section table.

Tighten these checks so valid edge cases are handled correctly.
2026-06-30 21:46:55 +08:00
datauwu 6333be32b8 7zip: add SFX boundary tests
Add PE and ELF SFX fixtures for the SFX scanner boundary cases.

The PE fixture places an empty 7z archive at the final exact
32-byte scan window. The ELF fixture places ".data\0" at the final
valid section string-table position.

Register the fixtures for autotools distcheck.
2026-06-30 21:46:54 +08:00
datauwu 00bafe21f1 fuzz: fix iteration comment
The fuzz test comment says each file is tested 100 times, but the
loop runs 1000 iterations. Update the comment to match the code.
2026-06-30 17:12:12 +08:00
datauwu 5e1afc9b42 zip: fix lzma/xz compression test name
The ZIP compression test name used lzmaxz even though the test covers
the LZMA and XZ compression paths. Rename it to lzma_xz.
2026-06-30 17:12:11 +08:00
datauwu e519625cf5 iso9660: fix compress test names
Several ISO tests used a bz2 suffix even though they read .Z files
and verify ARCHIVE_FILTER_COMPRESS. Rename them to use a compress
suffix so the test names match the filter.
2026-06-30 17:12:11 +08:00
datauwu ae78682a02 archive_write: group option setter tests
The write option setter checks used several tiny source files with the
same basic shape.

Keep the same DEFINE_TEST cases. Put the write-side option setter
checks in test_archive_write_set_options.c. Remove the extra source
files from the build lists.
2026-06-30 17:12:10 +08:00
datauwu 25533dd722 archive_read: group option setter tests
The read option setter checks used several tiny source files with the
same basic shape.

Keep the same DEFINE_TEST cases. Put the read-side option setter
checks in test_archive_read_set_options.c. Remove the extra source
files from the build lists.
2026-06-30 17:12:10 +08:00
datauwu d6e1e7bc3d archive_read: group close-twice tests
The close-twice read checks used three tiny source files.

Keep the same DEFINE_TEST cases. Put the fresh-object, fd-backed,
and filename-backed checks in one source file. Remove the two extra
files from the build lists.
2026-06-30 17:12:09 +08:00
datauwu 98b6197033 tests: fix incorrect charset labels
Several filename encoding tests were copied from KOI8-R or EUC-JP
cases, but now use CP1251 or CP932/SJIS instead.

Update skip messages, conversion messages, and comments to match the
locales and byte sequences used by the tests.

Also fix a typo in an EUC-JP ZIP filename skip message.
2026-06-29 17:59:34 +08:00
data ec9d2fb992 tar reader: avoid temporary buffer for empty-prefix ustar names
For empty-prefix ustar entries, copy the fixed-width name field
directly into the archive entry instead of first building a temporary
archive_string.

This avoids a temporary buffer allocation and intermediate copy in the
common case. It also fixes a small fatal-error leak by freeing the
temporary prefix/name buffer before returning on pathname conversion
failure.
2026-06-12 15:36:28 +08:00
datauwu f729237321 7zip: reject malformed SubStreamsInfo metadata
Validate the accumulated unpack stream count before allocating
per-substream metadata.

Reject folders that declare multiple substreams without kSize metadata,
since the parser needs those sizes to describe the stream layout.

Drop the explicit digest zeroing loop. The arrays are allocated with
calloc(), so the entries are already initialized.
2026-06-10 04:39:31 +08:00
datauwu 1960646fe8 7zip: add malformed SubStreamsInfo test
Add a 7z regression test for malformed SubStreamsInfo metadata that
declares more than one unpack stream without the kSize data needed to
describe those streams.

Store the archive as a .7z.uu file, matching the existing malformed
7z tests.
2026-06-10 03:10:27 +08:00
datauwu 68c78d5dbd iso9660: avoid negative duplicate suffix offsets
Avoid passing negative suffix offsets to the duplicate identifier
resolver. Clamp them where ISO9660 and Joliet identifiers decide
where the duplicate suffix should be written.
2026-05-21 10:55:26 +08:00
datauwu 9cc1878a13 iso9660: test duplicate Joliet identifier truncation
Add a test for ISO9660 entries whose Joliet identifiers collide
after default identifier truncation. The writer should resolve
the duplicate identifiers successfully when the archive is closed.
2026-05-20 09:36:20 +08:00
datauwu 1f2da75fb3 cpio: reject oversized pathnames before read-ahead
Reject malformed CPIO entries whose pathname field exceeds 1 MiB before asking the read-ahead layer to satisfy the padded pathname length.

This prevents newc archives with attacker-controlled c_namesize values from forcing large metadata read-ahead and pathname allocation during archive listing. Add a regression test that fails on the unpatched reader and passes once the cap is enforced.

Signed-off-by: datauwu <datauwu@users.noreply.github.com>
2026-05-17 17:34:06 +08:00