Bug fix: replace max with min

This commit is contained in:
Chris Hennick 2024-02-29 10:29:52 -08:00
parent ee1ef05fe6
commit 806c5d9fd8

View file

@ -10,7 +10,7 @@ fn decompress_all(data: &[u8]) -> Result<(), Box<dyn std::error::Error>> {
for i in 0..zip.len() { for i in 0..zip.len() {
let file = zip.by_index(i)?; let file = zip.by_index(i)?;
let expected_bytes = file.size().max(MAX_BYTES_TO_READ); let expected_bytes = file.size().min(MAX_BYTES_TO_READ);
let result = std::io::copy(&mut file.take(MAX_BYTES_TO_READ), &mut std::io::sink()); let result = std::io::copy(&mut file.take(MAX_BYTES_TO_READ), &mut std::io::sink());
if let Ok(bytes) = result { if let Ok(bytes) = result {
assert!(bytes <= expected_bytes) assert!(bytes <= expected_bytes)