rust-lang / flate2-rs

DEFLATE, gzip, and zlib bindings for Rust
https://docs.rs/flate2
Apache License 2.0
862 stars 159 forks source link

libz-rs backend causes errors and panics #413

Open VorpalBlade opened 1 month ago

VorpalBlade commented 1 month ago

If I switch to use libz-rs as the backend (instead of libz-ng) for https://github.com/VorpalBlade/paketkoll I get all of these errors:

 ❯ RUST_BACKTRACE=1 cargo run -- --trust-mtime check
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.07s
     Running `target/debug/paketkoll --trust-mtime check`
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
Ok: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
Ok: read_buf is full (8192 bytes)
Ok: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
Ok: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
Ok: read_buf is full (8192 bytes)
thread '<unnamed>' panicked at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1602:33:
not yet implemented
stack backtrace:
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
thread '<unnamed>' panicked at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1602:33:
not yet implemented
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
Ok: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
Ok: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
thread '<unnamed>' panicked at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1602:33:
not yet implemented
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
thread '<unnamed>' panicked at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1602:BufError: read_buf is full (338192:
 bytes)
not yet implemented
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
thread '<unnamed>' panicked at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1602:33:
not yet implemented
Ok: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
thread '<unnamed>' panicked at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1602:33:
not yet implemented
thread '<unnamed>' panicked at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1602:33:
not yet implemented
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
   0: rust_begin_unwind
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:145:5
   3: zlib_rs::inflate::inflate_fast_help
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1602:33
   4: zlib_rs::inflate::State::len
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1057:20
   5: zlib_rs::inflate::State::match_
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1260:13
   6: zlib_rs::inflate::State::dispatch
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:512:28
   7: zlib_rs::inflate::inflate
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1838:19
   8: libz_rs_sys::inflate
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libz-rs-sys-0.1.1/src/lib.rs:135:9
   9: <flate2::ffi::c::Inflate as flate2::ffi::InflateBackend>::decompress
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/ffi/c.rs:252:22
  10: flate2::mem::Decompress::decompress
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/mem.rs:452:9
  11: <flate2::mem::Decompress as flate2::zio::Ops>::run
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/zio.rs:72:9
  12: flate2::zio::read
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/zio.rs:135:19
  13: <flate2::deflate::bufread::DeflateDecoder<R> as std::io::Read>::read
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/deflate/bufread.rs:233:9
  14: <flate2::crc::CrcReader<R> as std::io::Read>::read
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/crc.rs:110:19
  15: <flate2::gz::bufread::GzDecoder<R> as std::io::Read>::read
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/gz/bufread.rs:294:27
  16: <flate2::gz::read::GzDecoder<R> as std::io::Read>::read
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/gz/read.rs:187:9
  17: std::io::Read::read_buf::{{closure}}
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:959:30
  18: std::io::default_read_buf
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:580:13
  19: std::io::Read::read_buf
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:959:9
  20: std::io::impls::<impl std::io::Read for &mut R>::read_buf
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/impls.rs:26:9
  21: std::io::buffered::bufreader::buffer::Buffer::fill_buf
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/buffered/bufreader/buffer.rs:114:13
  22: <std::io::buffered::bufreader::BufReader<R> as std::io::BufRead>::fill_buf
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/buffered/bufreader.rs:394:9
  23: std::io::read_until
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:2104:35
  24: std::io::BufRead::read_until
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:2350:9
  25: <std::io::Split<B> as core::iter::traits::iterator::Iterator>::next
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:3154:15
  26: <paketkoll_core::mtree::MTree<R> as core::iter::traits::iterator::Iterator>::next
             at ./crates/paketkoll_core/src/mtree/mod.rs:143:32
  27: core::iter::traits::iterator::Iterator::try_fold
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/traits/iterator.rs:2408:29
  28: core::iter::traits::iterator::Iterator::find_map
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/traits/iterator.rs:2911:9
  29: <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/adapters/filter_map.rs:64:9
  30: either::iterator::<impl core::iter::traits::iterator::Iterator for either::Either<L,R>>::next
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/either-1.12.0/src/iterator.rs:51:43
  31: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/adapters/map.rs:108:9
  32: <core::iter::adapters::take_while::TakeWhile<I,P> as core::iter::traits::iterator::Iterator>::next
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/adapters/take_while.rs:47:21
  33: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/adapters/map.rs:108:9
  34: alloc::vec::Vec<T,A>::extend_desugared
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/vec/mod.rs:2988:35
  35: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/vec/spec_extend.rs:17:9
  36: <alloc::vec::Vec<T,A> as core::iter::traits::collect::Extend<T>>::extend
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/vec/mod.rs:2962:9
  37: <rayon::iter::extend::ListVecFolder<T> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/extend.rs:130:9
  38: <rayon::iter::while_some::WhileSomeFolder<C> as rayon::iter::plumbing::Folder<core::option::Option<T>>>::consume_iter
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/while_some.rs:139:21
  39: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map.rs:248:21
  40: <rayon::iter::flat_map_iter::FlatMapIterFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/flat_map_iter.rs:126:20
  41: <rayon::iter::filter_map::FilterMapFolder<C,P> as rayon::iter::plumbing::Folder<T>>::consume
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/filter_map.rs:124:24
  42: <&rayon::iter::par_bridge::IterParallelProducer<Iter> as rayon::iter::plumbing::UnindexedProducer>::fold_with
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/par_bridge.rs:145:30
  43: rayon::iter::plumbing::bridge_unindexed_producer_consumer
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:478:33
  44: rayon::iter::plumbing::bridge_unindexed_producer_consumer::{{closure}}
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:474:31
  45: rayon_core::join::join_context::call_b::{{closure}}
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:129:25
  46: rayon_core::job::JobResult<T>::call::{{closure}}
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:218:41
  47: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panic/unwind_safe.rs:272:9
  48: std::panicking::try::do_call
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:552:40
  49: __rust_try
  50: std::panicking::try
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:516:19
  51: std::panic::catch_unwind
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panic.rs:146:14
  52: rayon_core::unwind::halt_unwinding
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/unwind.rs:17:5
  53: rayon_core::job::JobResult<T>::call
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:218:15
  54: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:120:32
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
  55: rayon_core::job::JobRef::execute
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:64:9
  56: rayon_core::registry::WorkerThread::execute
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:860:9
  57: rayon_core::registry::WorkerThread::wait_until_cold
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:794:21
  58: rayon_core::registry::WorkerThread::wait_until
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:769:13
  59: rayon_core::registry::WorkerThread::wait_until_out_of_work
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:818:9
  60: rayon_core::registry::main_loop
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:923:5
  61: rayon_core::registry::ThreadBuilder::run
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:53:18
  62: BufError: read_buf is full (<8192rayon_core bytes)
::registry::DefaultSpawn as rayon_core::registry::ThreadSpawn>::spawn::{{closure}}
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:98:20
BufError: read_buf is full (8192 bytes)
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

And so on, it keeps going. This is decompressing and parsing files from the package cache of the distro I'm running on (Arch Linux).

I have attached a minimal reproducer of it, which consists of a small project plus an example.gz file that triggers these: flate2-reproducer.tar.gz. To reproduce enter the project and run cargo run:

❯ RUST_BACKTRACE=1 cargo run        
   Compiling libc v0.2.155
   Compiling cfg-if v1.0.0
   Compiling cc v1.0.98
   Compiling adler v1.0.2
   Compiling memchr v2.7.2
   Compiling gimli v0.29.0
   Compiling rustc-demangle v0.1.24
   Compiling anyhow v1.0.86
   Compiling zlib-rs v0.1.1
   Compiling miniz_oxide v0.7.3
   Compiling crc32fast v1.4.2
   Compiling object v0.35.0
   Compiling addr2line v0.22.0
   Compiling libz-rs-sys v0.1.1
   Compiling flate2 v1.0.30
   Compiling backtrace v0.3.72
   Compiling flate2-reproducer v0.1.0 (/home/arvid/src/flate2-reproducer)
warning: field `data` is never read
  --> src/main.rs:20:5
   |
19 | struct Data {
   |        ---- field in this struct
20 |     data: String,
   |     ^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: `flate2-reproducer` (bin "flate2-reproducer") generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.03s
     Running `target/debug/flate2-reproducer`
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
BufError: read_buf is full (8192 bytes)
thread 'main' panicked at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1602:33:
not yet implemented
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:145:5
   3: zlib_rs::inflate::inflate_fast_help
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1602:33
   4: zlib_rs::inflate::State::len
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1057:20
   5: zlib_rs::inflate::State::match_
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1260:13
   6: zlib_rs::inflate::State::dispatch
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:512:28
   7: zlib_rs::inflate::inflate
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zlib-rs-0.1.1/src/inflate.rs:1838:19
   8: libz_rs_sys::inflate
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libz-rs-sys-0.1.1/src/lib.rs:135:9
   9: <flate2::ffi::c::Inflate as flate2::ffi::InflateBackend>::decompress
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/ffi/c.rs:252:22
  10: flate2::mem::Decompress::decompress
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/mem.rs:452:9
  11: <flate2::mem::Decompress as flate2::zio::Ops>::run
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/zio.rs:72:9
  12: flate2::zio::read
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/zio.rs:135:19
  13: <flate2::deflate::bufread::DeflateDecoder<R> as std::io::Read>::read
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/deflate/bufread.rs:233:9
  14: <flate2::crc::CrcReader<R> as std::io::Read>::read
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/crc.rs:110:19
  15: <flate2::gz::bufread::GzDecoder<R> as std::io::Read>::read
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/gz/bufread.rs:294:27
  16: <flate2::gz::read::GzDecoder<R> as std::io::Read>::read
             at /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.30/src/gz/read.rs:187:9
  17: std::io::Read::read_buf::{{closure}}
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:959:30
  18: std::io::default_read_buf
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:580:13
  19: std::io::Read::read_buf
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:959:9
  20: std::io::impls::<impl std::io::Read for &mut R>::read_buf
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/impls.rs:26:9
  21: std::io::buffered::bufreader::buffer::Buffer::fill_buf
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/buffered/bufreader/buffer.rs:114:13
  22: <std::io::buffered::bufreader::BufReader<R> as std::io::BufRead>::fill_buf
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/buffered/bufreader.rs:394:9
  23: std::io::read_until
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:2104:35
  24: std::io::BufRead::read_until
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:2350:9
  25: <std::io::Split<B> as core::iter::traits::iterator::Iterator>::next
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:3154:15
  26: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/adapters/map.rs:108:9
  27: flate2_reproducer::main
             at ./src/main.rs:12:18
  28: core::ops::function::FnOnce::call_once
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

(Note: I'm aware of the extra layer of BufReader on top of the gzip stream seems a bit pointless, but in the actual code that happens internally to a library I'm using for the parsing, and as such I have no control over that.)

Byron commented 1 month ago

Thanks for reporting and even more so for the reproducer. I hope @folkertdev can also take a look, maybe it's an issue with the underlying library or the way it's called.

folkertdev commented 1 month ago

thanks for reporting this and providing such a nice reproduction. This exposed a subtle bug in zlib-rs that I've now fixed locally. We'll publish a new version next week and can hopefully bump flate2 to use that.