diff --git a/src/read.rs b/src/read.rs index 01dc0fa5..752dce1d 100644 --- a/src/read.rs +++ b/src/read.rs @@ -386,3 +386,17 @@ impl<'a> Read for ZipFile<'a> { self.get_reader().read(buf) } } + +#[cfg(test)] +mod test { + #[test] + fn invalid_offset() { + use std::io; + use super::ZipArchive; + + let mut v = Vec::new(); + v.extend_from_slice(include_bytes!("../tests/data/invalid_offset.zip")); + let reader = ZipArchive::new(io::Cursor::new(v)); + assert!(reader.is_err()); + } +} diff --git a/tests/data/invalid_offset.zip b/tests/data/invalid_offset.zip new file mode 100644 index 00000000..9ff2e07f Binary files /dev/null and b/tests/data/invalid_offset.zip differ