]> git.ipfire.org Git - thirdparty/libarchive.git/commit
RAR5 reader: early fail when file declares data for a dir entry 2716/head
authorGrzegorz Antoniak <ga@anadoxin.org>
Mon, 4 Aug 2025 13:07:32 +0000 (15:07 +0200)
committerGrzegorz Antoniak <ga@anadoxin.org>
Mon, 4 Aug 2025 17:52:53 +0000 (19:52 +0200)
commitcb403667d721a10f401c145742e2f7e051867003
tree1da58a01c8a855285c11a1551a4fd704f4036f2f
parent6062470cbcf5ff76535b6f161ce9cc9f4c6f56c0
RAR5 reader: early fail when file declares data for a dir entry

RAR5 reader had inconsistent sanity checks for directory entries that
declare data. On one hand such declaration was accepted during the
header parsing process, but at the same time this was disallowed during
the data reading process. Disallow logic was returning the
ARCHIVE_FAILED error code that allowed the client to retry, while in
reality, the error was non-retryable.

This commit adds another sanity check during the header parsing logic
that disallows the directory entries to declare any data. This will make
clients fail early when such entry is detected.

Also, the commit changes the ARCHIVE_FAILED error code to ARCHIVE_FATAL
when trying to read data for the directory entry that declares data.
This makes sure that tools like bsdtar won't attempt to retry unpacking
such data.

Fixes issue #2714.
Makefile.am
libarchive/archive_read_support_format_rar5.c
libarchive/test/test_read_format_rar5.c
libarchive/test/test_read_format_rar5_dirdata.rar.uu [new file with mode: 0644]