Prevent infinite loop from crafted/corrupt archive in unzip_match.

This commit is contained in:
Con Kolivas 2018-05-16 19:26:15 +10:00
parent b84c710902
commit 50cfb3b9f6

View file

@ -219,6 +219,8 @@ static i64 unzip_match(rzip_control *control, void *ss, i64 len, uint32 *cksum,
while (len) {
n = MIN(len, offset);
if (unlikely(n < 1))
fatal_return(("Failed fd history in unzip_match due to corrupt archive\n"), -1);
if (unlikely(read_fdhist(control, off_buf, (size_t)n) != (ssize_t)n)) {
dealloc(buf);