You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the underlying writer only accepts very small write request the flush process of a ZlibEncoder appears to try and write the same data infinitely often.
Full reproduction source code
use std::io::{self,Write};fnmain(){let _ = deflate::write::ZlibEncoder::new(SmallWriter::new(vec![],2), deflate::Compression::Fast).flush();}structSmallWriter<W:Write>{writer:W,small:usize,}impl<W:Write>SmallWriter<W>{fnnew(writer:W,buf_len:usize) -> SmallWriter<W>{SmallWriter{
writer,small: buf_len,}}}impl<W:Write>WriteforSmallWriter<W>{fnwrite(&mutself,buf:&[u8]) -> io::Result<usize>{// Never write more than `small` bytes at a time.let small = buf.len().min(self.small);self.writer.write(&buf[..small])}fnflush(&mutself) -> io::Result<()>{Ok(())}}
The text was updated successfully, but these errors were encountered:
I think it may be due to flush trying to output an empty block stored block (as per zlib sync flush) at the end when called, which won't fit in two bytes. Will try to find some way of solving it.
When the underlying writer only accepts very small write request the flush process of a
ZlibEncoder
appears to try and write the same data infinitely often.Full reproduction source code
The text was updated successfully, but these errors were encountered: