Skip to content

Commit

Permalink
Merge pull request #581 from dotnet/fix580
Browse files Browse the repository at this point in the history
Avoid writing garbage bytes to read blobs in managed git engine
  • Loading branch information
AArnott committed Apr 7, 2021
2 parents 707e619 + ae45375 commit 536c1fd
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -49,9 +49,9 @@ public override int Read(Span<byte> buffer)
{
var currentPosition = this.cacheStream.Position;
var toRead = (int)(buffer.Length - this.cacheStream.Length + this.cacheStream.Position);
this.stream.Read(buffer.Slice(0, toRead));
int actualRead = this.stream.Read(buffer.Slice(0, toRead));
this.cacheStream.Seek(0, SeekOrigin.End);
this.cacheStream.Write(buffer.Slice(0, toRead));
this.cacheStream.Write(buffer.Slice(0, actualRead));
this.cacheStream.Seek(currentPosition, SeekOrigin.Begin);
this.DisposeStreamIfRead();
}
Expand Down

0 comments on commit 536c1fd

Please sign in to comment.