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
{{ message }}
Repository navigation
Gzip decompress Unexpected EOF with small buffer + fix #360
Yeah, this needs to be resolved before 1.2, something is clearly not behaving as expected. Why would a smaller buffer make that condition return false?
Possibly it's incorrectly throwing in cases where the inflator has used up its own internal buffer, but the input stream still has data left? (maybe it should only be doing that check if bytesRead is 0?)
Changing it to throw if inf.RemainingInput and bytesRead are both 0 fixes the test failure (e.g.
else if (inf.RemainingInput == 0 && bytesRead == 0)
Not certain if that is the right fix though (I hadn't previously realised that it explicitly tries to not throw in cases where there is garbage in the stream after the end of the valid data).
Okay, I finally know whats going on! I was wrong, see #372 for the real solution.
There is no more Input to read, since all the bytes have been read, but no more bytes will be written to the output buffer since it's full. So a simple fix would be to check if the buffer is full (bytesRead == count). If the buffer sizes exactly matches up with the needed bytes I think the next read should be 0 bytesRead, but some more testing is needed.
Activity
Numpsy commentedon Jun 21, 2019
It looks like the ReadWriteThroughtput GZip unit test fails with the same exception (that test is marked as explicit, so it isn't run by default).
Looks like that throw was only added in a35ce40, don't know if removing it reverts part of that fix.
piksel commentedon Jun 24, 2019
Yeah, this needs to be resolved before 1.2, something is clearly not behaving as expected. Why would a smaller buffer make that condition return false?
Numpsy commentedon Jun 24, 2019
Possibly it's incorrectly throwing in cases where the inflator has used up its own internal buffer, but the input stream still has data left? (maybe it should only be doing that check if bytesRead is 0?)
piksel commentedon Jun 24, 2019
Yes, that could be it. Due to confusion about what
inf.RemainingInputrefers to...Numpsy commentedon Jul 28, 2019
Changing it to throw if inf.RemainingInput and bytesRead are both 0 fixes the test failure (e.g.
Not certain if that is the right fix though (I hadn't previously realised that it explicitly tries to not throw in cases where there is garbage in the stream after the end of the valid data).
Add test reproducing issue #360
Merge PR #371: Add test for GZip with small buffer
piksel commentedon Aug 6, 2019
Okay, I finally know whats going on!I was wrong, see #372 for the real solution.There is no more Input to read, since all the bytes have been read, but no more bytes will be written to the output buffer since it's full. So a simple fix would be to check if the buffer is full (
bytesRead == count). If the buffer sizes exactly matches up with the needed bytes I think the next read should be0 bytesRead, but some more testing is needed.