]> git.ipfire.org Git - thirdparty/libarchive.git/commit
archive_read: Handle sparse holes at end of file 2665/head
authorTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 3 Jun 2025 20:00:13 +0000 (22:00 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 3 Jun 2025 20:01:15 +0000 (22:01 +0200)
commitb1839a20e506c46253567202fff26b27592e4a5c
tree6dc6cfea6efa2aa549b573dd0ea3173b3578763b
parentf3949062edd13da3d0ac330d3226871350f3ff6b
archive_read: Handle sparse holes at end of file

If a sparse hole is located at the end of an entry, then the tar
parser returns ARCHIVE_EOF while updating the offset where 0 bytes of
data will follow.

If archive_read_data encounters such an ARCHIVE_EOF return value, it
has to recheck if the offsets (data offset and output offset) still
match. If they do not match, it has to keep filling 0 bytes.

This changes assumes that it's okay to call archive_read_data_block
again after an EOF. As far as I understood the parsers so far, this
should be okay, since it's always ARCHIVE_EOF afterwards.

Fixes https://github.com/libarchive/libarchive/issues/1194

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_read.c