diff options
Diffstat (limited to 'third_party/rust/zip')
-rw-r--r-- | third_party/rust/zip/src/read.rs | 9 | ||||
-rw-r--r-- | third_party/rust/zip/src/types.rs | 2 | ||||
-rw-r--r-- | third_party/rust/zip/src/write.rs | 1 |
3 files changed, 4 insertions, 8 deletions
diff --git a/third_party/rust/zip/src/read.rs b/third_party/rust/zip/src/read.rs index dad20c260b..3f3f41010c 100644 --- a/third_party/rust/zip/src/read.rs +++ b/third_party/rust/zip/src/read.rs @@ -334,13 +334,10 @@ impl<R: Read + io::Seek> ZipArchive<R> { // offsets all being too small. Get the amount of error by comparing // the actual file position we found the CDE at with the offset // recorded in the CDE. - let archive_offset = cde_start_pos - .checked_sub(footer.central_directory_size as u64) - .and_then(|x| x.checked_sub(footer.central_directory_offset as u64)) - .ok_or(ZipError::InvalidArchive( - "Invalid central directory size or offset", - ))?; + // Bug 1895599: omnijars nor other zips we read have data prepended to them; trust + // the offsets! + let archive_offset = 0; let directory_start = footer.central_directory_offset as u64 + archive_offset; let number_of_files = footer.number_of_files_on_this_disk as usize; Ok((archive_offset, directory_start, number_of_files)) diff --git a/third_party/rust/zip/src/types.rs b/third_party/rust/zip/src/types.rs index ad3a5700b2..896c9a6ff5 100644 --- a/third_party/rust/zip/src/types.rs +++ b/third_party/rust/zip/src/types.rs @@ -7,8 +7,6 @@ use std::convert::{TryFrom, TryInto}; target_arch = "powerpc" )))] use std::sync::atomic; -#[cfg(not(feature = "time"))] -use std::time::SystemTime; #[cfg(doc)] use {crate::read::ZipFile, crate::write::FileOptions}; diff --git a/third_party/rust/zip/src/write.rs b/third_party/rust/zip/src/write.rs index 14252b4d59..214aafecd0 100644 --- a/third_party/rust/zip/src/write.rs +++ b/third_party/rust/zip/src/write.rs @@ -7,6 +7,7 @@ use crate::spec; use crate::types::{AtomicU64, DateTime, System, ZipFileData, DEFAULT_VERSION}; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use crc32fast::Hasher; +#[cfg(feature = "time")] use std::convert::TryInto; use std::default::Default; use std::io; |