Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/ICSharpCode.SharpZipLib/GZip/GzipInputStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,10 @@ public override int Read(byte[] buffer, int offset, int count)
if (inf.IsFinished)
{
ReadFooter();
} else if (inf.RemainingInput == 0) {
// If the stream is not finished but we have no more data to read, don't keep looping forever
throw new GZipException("Unexpected EOF");
}

if (bytesRead > 0)
// Attempting to read 0 bytes will never yield any bytesRead, so we return instead of looping forever
if (bytesRead > 0 || count == 0)
{
return bytesRead;
}
Expand Down