Skip to content

Commit

Permalink
include 5E and DA values in zlib header check
Browse files Browse the repository at this point in the history
  • Loading branch information
rhodosaur authored and AArnott committed Jun 21, 2021
1 parent a0fb5ac commit 1f1cf8b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/NerdBank.GitVersioning/ManagedGit/ZLibStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Buffers;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -56,9 +57,9 @@ public ZLibStream(Stream stream, long length = -1)
Span<byte> zlibHeader = stackalloc byte[2];
stream.ReadAll(zlibHeader);

if (zlibHeader[0] != 0x78 || (zlibHeader[1] != 0x01 && zlibHeader[1] != 0x9C))
if (zlibHeader[0] != 0x78 || (zlibHeader[1] != 0x01 && zlibHeader[1] != 0x9C && zlibHeader[1] != 0x5E && zlibHeader[1] != 0xDA))
{
throw new GitException();
throw new GitException($"Invalid zlib header {string.Join(" ", zlibHeader.ToArray().Select(b => $"{b:X2}"))}");
}
}

Expand Down

0 comments on commit 1f1cf8b

Please sign in to comment.