From be28a9d813056e6f86a1f71d6cbb45d2d100f17f Mon Sep 17 00:00:00 2001 From: Lilith River Date: Thu, 5 Sep 2024 17:53:19 -0400 Subject: [PATCH] Fix libpng diagnostics for unexpctedeof --- imageflow_core/src/codecs/libpng_decoder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imageflow_core/src/codecs/libpng_decoder.rs b/imageflow_core/src/codecs/libpng_decoder.rs index 84e8bdff..88d3a47b 100644 --- a/imageflow_core/src/codecs/libpng_decoder.rs +++ b/imageflow_core/src/codecs/libpng_decoder.rs @@ -161,11 +161,11 @@ impl PngDec{ let len = decoder.io.try_get_length(); let pos = decoder.io.try_get_position(); let remaining = if len.is_some() && pos.is_some() { - Some(len.unwrap() - pos.unwrap()) + Some(len.unwrap() as i64 - pos.unwrap() as i64) } else { None }; - let missing = remaining.map(|r| (bytes_requested as u64) - r); + let missing = remaining.map(|r| (bytes_requested as i64) - (r as i64)); let err = FlowError::without_location(ErrorKind::DecodingIoError, format!("{:?} (failed to read requested {} bytes (only {:?} remain), pos={:?}, len={:?}, missing={:?})", err, bytes_requested, remaining, pos, len, missing)).at(here!());