]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Ignore sizes which do not fit into off_t 2688/head
authorTobias Stoeckmann <tobias@stoeckmann.org>
Fri, 27 Jun 2025 15:06:00 +0000 (17:06 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Fri, 27 Jun 2025 15:06:14 +0000 (17:06 +0200)
commit1e4b84ed3089a8b7bb78c7e5af96716c602f621a
tree58a6f387f065df46bed180d85a14228fff175823
parentffde04f27231cabb91cebcbd7eca08d0f5088dc8
Ignore sizes which do not fit into off_t

It is possible to handle entries and files with sizes which do not fit
into off_t of the current system (Windows always has 32 bit off_t and
32 bit systems without large file support also have 32 bit off_t).

Set sizes to 0 in such cases. The fstat system call would return -1 and
set errno to EOVERFLOW, but that's not how archive_entry_set_size acts.
It would simply ignore negative values and set the size to 0.

Actual callers of archive_entry_stat from foreign projects seem to not
even check for NULL return values, so let's try to handle such cases as
nice as possible.

Affects mtree's checkfs option as well (Windows only, 32 bit systems
would simply fail in fstat/stat).

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_entry_stat.c
libarchive/archive_windows.c
libarchive/test/test_entry.c