Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
fix: add header offset overflow check
Browse files Browse the repository at this point in the history
- during the header offset calculation, perform overflow check

Tested:
- Local tests
  • Loading branch information
zamazan4ik committed Jan 22, 2022
1 parent 06b4101 commit 8a666b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,10 @@ pub(crate) fn central_header_to_zip_file<R: Read + io::Seek>(
}

// Account for shifted zip offsets.
result.header_start += archive_offset;
result.header_start = result
.header_start
.checked_add(archive_offset)
.ok_or(ZipError::InvalidArchive("Archive header is too large"))?;

Ok(result)
}
Expand Down

0 comments on commit 8a666b1

Please sign in to comment.