Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeflateDecoder truncates output when underlying reader returns single bytes #46

Open
programmerjake opened this issue Aug 14, 2018 · 3 comments

Comments

@programmerjake
Copy link
Author

I would expect the test program to print "Test" twice.

@programmerjake
Copy link
Author

the issue still exists in version 0.4.5

@philipc
Copy link
Contributor

philipc commented Apr 20, 2019

The problem is:

  • BufReader::fill_buf will only read 1 byte
  • InflateStream::update can't make progress with 1 byte input, and so returns 0 byte output
  • thus DeflateDecoderBuf::read will return 0 bytes signifying EOF and Bytes::next will return None

We can't even fix this by calling BufReader:fill_buf again because it only reads when the buffer is empty.

So in my opinion, DeflateDecoderBuf needs to be rewritten without using BufReader. This isn't something I plan to work on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants