23 Commits
Author SHA1 Message Date
Kaif Khan 992cf1fc0b pax: use checked size arithmetic in base64_encode 2026-07-14 18:46:00 +05:30
Kaif Khan 54b7f1f679 xar: fix one-byte over-read in parse_time date parser 2026-07-13 19:31:09 +05:30
Kaif Khan b76abee5b1 cpio: add regression test for symlink-trailer end-of-archive check
A symlink entry named TRAILER!!! with a body large enough to grow the
read filter's copy buffer used to leave the cached name pointer stale
before the end-of-archive comparison.  Read a static newc archive in
small blocks and assert the trailer is still detected (ARCHIVE_EOF).

The fix landed in 23b54da; this only adds coverage.
2026-07-13 11:44:09 +05:30
Kaif Khan 9b5dae145f archive_string: bound best_effort_strncat_in_locale to length
remaining was set to length but never decremented, so the loop only stopped at a NUL and read past fields passed without a trailing NUL (a read_ahead window sized by mbsnbytes). Decrement per byte and check the count before dereferencing *itp.
2026-07-08 22:10:27 +05:30
Kaif Khan 18449a3f8d archive_string: add test for best-effort converter over-read
Drives the best-effort converter (charset iconv cannot open) through
archive_strncpy_l with a length-delimited buffer: once with trailing
non-NUL bytes after the declared length and once with an exact-length
heap allocation with no trailing NUL. Fails under ASan before the fix.
2026-07-08 22:10:19 +05:30
Kaif Khan e5d72383a6 7zip: bound NumFolders before allocating folders array 2026-07-08 01:13:52 +05:30
Kaif Khan 91648e29bd tar: add test for SUN.holesdata sparse map ending on a digit
Read a Solaris pax entry whose SUN.holesdata value ends right after its
final decimal offset (no trailing space), which is the shape of every
valid map. The 1536-byte file has data at [0,512) and [1024,1536) with a
hole between them, so archive_entry_sparse must report exactly those two
data blocks. This pins the parser's loop-termination behavior for the
common case where the run consumes all value_length bytes.
2026-07-07 23:44:50 +05:30
Kaif Khan 5c61644fdb mtree: fix out-of-bounds read in process_global_set 2026-07-07 14:19:03 +05:30
Kaif Khan 70e4b8c511 acl: fix over-read on empty field in archive_acl_from_text_nl
archive_acl_from_text_nl() parses ACL text from a pointer and a length
and does not require a NUL terminator; the tar reader passes a
__archive_read_ahead() window of exactly value_length bytes for
SCHILY.acl.access/.default/.ace.  When an entry is empty (a
whitespace-only value, or trailing whitespace after a valid entry)
next_field() consumes the rest of the buffer as whitespace and leaves
field[0].start one past the end, which the '#'-comment probe then
dereferences.  Capture the buffer end and skip the entry when its first
field starts there.  The wide archive_acl_from_text_w is NUL terminated
and unaffected.
2026-07-05 13:39:58 +05:30
Kaif Khan 18f5209e48 acl: add test_acl_from_text_overread regression test
Drives archive_acl_from_text_nl() with exact-length, non-NUL-terminated
buffers whose first field is only whitespace, covering the empty-entry
and trailing-whitespace cases.  Allow the test to include
archive_acl_private.h via __LIBARCHIVE_TEST.
2026-07-05 13:39:52 +05:30
Kaif Khan 262461917e pathmatch: guard end-of-string before wide bracket class match 2026-07-02 22:36:44 +05:30
Kaif Khan 10ca288a48 test: cover wide bracket over-read in pm_w 2026-07-02 22:36:44 +05:30
Kaif Khan a9a73c0e63 iso9660: check ZF entry length before reading data bytes 2026-06-29 11:28:39 +05:30
Kaif Khan 86e5498285 iso9660: add regression test for short ZF entry over-read 2026-06-29 11:28:38 +05:30
Kaif Khan 62be4ffdc4 xar: stop atou64 reading one byte past the numeric field 2026-06-26 13:57:18 +05:30
Kaif Khan 0352fe5033 xar: add regression test for atou64 numeric field over-read
Exercise atou64() through a TOC numeric element (<inode>) read via the
expat backend, which hands the parser its raw, non-NUL-terminated
character-data buffer. Mirrors test_read_format_xar_base64_oob; build
with ASan for the out-of-bounds coverage.
2026-06-26 13:57:11 +05:30
Kaif Khan 1be2aea27e gnutar: fix stack overflow writing oversized gname field 2026-06-25 22:22:56 +05:30
Kaif Khan f2e80fff9c gnutar: add regression test for oversized gname field 2026-06-25 22:22:56 +05:30
Kaif Khan e1730385ee unzip: reject bare '..' and trailing '/..' in pathname_is_insecure 2026-06-24 12:00:05 +05:30
Kaif Khan 79fe496410 unzip: add regression test for insecure '..' symlink targets 2026-06-24 12:00:05 +05:30
Kaif Khan d78dda0304 xar: fix OOB read decoding odd-length base64 in strappend_base64 2026-06-24 10:56:44 +05:30
Kaif Khan 98c25d8b5c xar: add regression test for odd-length base64 name decoding
Crafted TOC with a base64-encoded <name> of odd length, which used to
make strappend_base64() read past the character-data buffer. The trailing
incomplete base64 character is dropped; the rest still decodes.
2026-06-24 10:56:44 +05:30
uchiha-bug-hunter 849eeab664 cpio: fix OOB read from int pathlength truncation in newc/binary writers 2026-06-22 15:11:13 +05:30