Catch decompression failures earlier. In particular, this gives

immediate feedback if we fail to fork an external decompression program.
This commit is contained in:
Tim Kientzle 2009-12-29 05:30:23 +00:00
parent e2196d3e85
commit dee0ce0cbd

View File

@ -354,6 +354,7 @@ build_stream(struct archive_read *a)
int number_bidders, i, bid, best_bid;
struct archive_read_filter_bidder *bidder, *best_bidder;
struct archive_read_filter *filter;
ssize_t avail;
int r;
for (;;) {
@ -392,6 +393,13 @@ build_stream(struct archive_read *a)
free(filter);
return (r);
}
/* Verify the filter by asking it for some data. */
__archive_read_filter_ahead(filter, 1, &avail);
if (avail < 0) {
/* If the read failed, bail out now. */
free(filter);
return (avail);
}
a->filter = filter;
}
}