Add a test for ZIP64 with leading junk.
I constructed this file using a hack from the Zip manpage: if the input to a Zip compression command is streamed on standard input, the output is given in ZIP64 format since the tool doesn't know how big the input will be. I modified the resulting file by adding some leading junk text and editing the non-ZIP64 end-of-central-directory structure to have 0xFFFF for its "number of files" parameters, to help the test demonstrate that the ZIP64 data are being properly read. (0xFFFF is the value used in the non-ZIP64 structure if the archive actually has more than 65535 files.)
This commit is contained in:
parent
4a297c32a8
commit
f85b5cb7b8
2 changed files with 11 additions and 0 deletions
11
src/read.rs
11
src/read.rs
|
@ -465,4 +465,15 @@ mod test {
|
|||
let reader = ZipArchive::new(io::Cursor::new(v));
|
||||
assert!(reader.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zip64_with_leading_junk() {
|
||||
use std::io;
|
||||
use super::ZipArchive;
|
||||
|
||||
let mut v = Vec::new();
|
||||
v.extend_from_slice(include_bytes!("../tests/data/zip64_demo.zip"));
|
||||
let reader = ZipArchive::new(io::Cursor::new(v)).unwrap();
|
||||
assert!(reader.len() == 1);
|
||||
}
|
||||
}
|
||||
|
|
BIN
tests/data/zip64_demo.zip
Normal file
BIN
tests/data/zip64_demo.zip
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue