When skipping input data, don't overflow a 32-bit size_t.

This can only happen on 32-bit systems when you're reading
an uncompressed archive and the skip request is an exact
multiple of 4G (e.g., skipping a tar entry with an 8G body).

The symptom is that the read_ahead() ends up returning zero
bytes, and the extraction stops with a premature end-of-file.

Using '1' here is more correct anyway, as it allows read_ahead()
to function opportunistically and minimize copying.

MFC after: 5 days
This commit is contained in:
Tim Kientzle 2007-10-27 22:45:40 +00:00
parent 5dfb7ce5fc
commit c383d82e4d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173085

View File

@ -334,7 +334,7 @@ archive_decompressor_none_skip(struct archive_read *a, off_t request)
const void* dummy_buffer;
ssize_t bytes_read;
bytes_read = archive_decompressor_none_read_ahead(a,
&dummy_buffer, request);
&dummy_buffer, 1);
if (bytes_read < 0)
return (bytes_read);
if (bytes_read == 0) {