Skip to content

Commit 1f1cf8b

Browse files
rhodosaurAArnott
authored andcommitted
include 5E and DA values in zlib header check
1 parent a0fb5ac commit 1f1cf8b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/NerdBank.GitVersioning/ManagedGit/ZLibStream.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Buffers;
66
using System.IO;
77
using System.IO.Compression;
8+
using System.Linq;
89
using System.Threading;
910
using System.Threading.Tasks;
1011

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

59-
if (zlibHeader[0] != 0x78 || (zlibHeader[1] != 0x01 && zlibHeader[1] != 0x9C))
60+
if (zlibHeader[0] != 0x78 || (zlibHeader[1] != 0x01 && zlibHeader[1] != 0x9C && zlibHeader[1] != 0x5E && zlibHeader[1] != 0xDA))
6061
{
61-
throw new GitException();
62+
throw new GitException($"Invalid zlib header {string.Join(" ", zlibHeader.ToArray().Select(b => $"{b:X2}"))}");
6263
}
6364
}
6465

0 commit comments

Comments
 (0)