From da4c7e7ed675c3bf405668739c3012d140856109 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:34:42 +0200 Subject: Adding upstream version 126.0. Signed-off-by: Daniel Baumann --- third_party/rust/zip/src/read.rs | 9 +++------ third_party/rust/zip/src/types.rs | 2 -- third_party/rust/zip/src/write.rs | 1 + 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'third_party/rust/zip') 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 ZipArchive { // 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; -- cgit v1.2.3