Skip to content

Commit

Permalink
Prevent infinite loop from crafted/corrupt archive in unzip_match.
Browse files Browse the repository at this point in the history
  • Loading branch information
ckolivas committed May 16, 2018
1 parent b84c710 commit 50cfb3b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions runzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 50cfb3b

Please # to comment.