dotnet/Nerdbank.Streams

SubstreamReader fails when underlying stream returns only part of 4 byte header

leeview opened this issue · 2 comments

In src/Nerdbank.Streams/SubstreamReader.cs at line 106 there is a subtle bug there:

int bytesJustRead = this.underlyingStream.Read(this.intBuffer, 0, 4 - bytesRead);

should be

int bytesJustRead = this.underlyingStream.Read(this.intBuffer, bytesRead, 4 - bytesRead);

Thanks for the report!

The fix is shipped in 2.4.59