struct tree *t = a->tree;
int r;
ssize_t bytes;
+ int64_t sparse_bytes;
size_t buffbytes;
int empty_sparse_region = 0;
a->archive.state = ARCHIVE_STATE_FATAL;
goto abort_read_data;
}
- bytes = t->current_sparse->offset - t->entry_total;
- t->entry_remaining_bytes -= bytes;
- t->entry_total += bytes;
+ sparse_bytes = t->current_sparse->offset - t->entry_total;
+ t->entry_remaining_bytes -= sparse_bytes;
+ t->entry_total += sparse_bytes;
}
/*
assert(DeviceIoControl(handle, FSCTL_SET_SPARSE, NULL, 0,
NULL, 0, &dmy, NULL) != 0);
- size_t offsetSoFar = 0;
+ uint64_t offsetSoFar = 0;
while (s->type != END) {
if (s->type == HOLE) {
{
char buff[1024];
int fd;
- size_t total_size = 0;
+ uint64_t total_size = 0;
const struct sparse *cur = s;
memset(buff, ' ', sizeof(buff));
{ HOLE, 1 }, { DATA, 10240 },
{ END, 0 }
};
+ const struct sparse sparse_file4[] = {
+ { DATA, 4096 }, { HOLE, 0xc0000000 },
+ /* This hole overflows the offset if stored in 32 bits. */
+ { DATA, 4096 }, { HOLE, 0x50000000 },
+ { END, 0 }
+ };
/*
* Test for the case that sparse data indicates just the whole file
verify_sparse_file(a, "file2", sparse_file2, 20);
/* Encoded non sparse; expect a data block but no sparse entries. */
verify_sparse_file(a, "file3", sparse_file3, 0);
+ verify_sparse_file(a, "file4", sparse_file4, 2);
assertEqualInt(ARCHIVE_OK, archive_read_free(a));