From c0043c1a8413c7d523bf68399508ad5b964e8f30 Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Sat, 27 Jun 2026 12:47:51 +0100 Subject: [PATCH] Use zrip-decode crate instead of ruzstd --- Cargo.toml | 6 +++--- src/decoder/image.rs | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2896ebb..a8537be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ fax34 = { package = "fax", version = "0.2.6", optional = true } flate2 = { version = "1.0.20", optional = true } weezl = { version = "0.1.10", optional = true } zstd = { version = "0.13", optional = true } -ruzstd = { version = "0.8.2", optional = true } +zrip-decode = { version = "0.7.0", features = ["paranoid"], optional = true } zune-jpeg = { version = "0.5.1", optional = true } image-webp = {version = "0.2.4", optional = true } @@ -46,9 +46,9 @@ jpeg = ["dep:zune-jpeg"] lzw = ["dep:weezl"] webp = ["dep:image-webp"] zstd = ["dep:zstd"] -# Fully safe Rust but much slower Zstd decoding. +# Fully safe Rust but somewhat slower Zstd decoding. # When both zstd and zstd-safe-rust are enabled, zstd takes precedence. -zstd-safe-rust = ["dep:ruzstd"] +zstd-safe-rust = ["dep:zrip-decode"] [[bench]] name = "lzw" diff --git a/src/decoder/image.rs b/src/decoder/image.rs index 6d0dc24..3a107b7 100644 --- a/src/decoder/image.rs +++ b/src/decoder/image.rs @@ -660,10 +660,7 @@ impl Image { #[cfg(feature = "zstd")] CompressionMethod::ZSTD => Box::new(zstd::Decoder::new(reader)?), #[cfg(all(not(feature = "zstd"), feature = "zstd-safe-rust"))] - CompressionMethod::ZSTD => Box::new( - ruzstd::decoding::StreamingDecoder::new(reader) - .map_err(|e| std::io::Error::other(e))?, - ), + CompressionMethod::ZSTD => Box::new(zrip_decode::streaming::FrameDecoder::new(reader)), CompressionMethod::PackBits => Box::new(PackBitsReader::new(reader, compressed_length)), #[cfg(feature = "deflate")] CompressionMethod::Deflate | CompressionMethod::OldDeflate => {