Skip to content

Commit 4742318

Browse files
committed
Z-1802 Fix incorrect subfield handling in Gzip header with FEXTRA
1 parent 66070d4 commit 4742318

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

src/GZip/GzipInputStream.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
// HISTORY
4040
// 2009-08-11 T9121 Geoff Hart Added Multi-member gzip support
41-
// 2012-06-03 Z-1802 Incorrect endianness in FEXTRA handling
41+
// 2012-06-03 Z-1802 Incorrect endianness and subfield in FEXTRA handling.
4242

4343
using System;
4444
using System.IO;
@@ -258,19 +258,8 @@ bit 7 reserved
258258

259259
// 7. Read extra field
260260
if ((flags & GZipConstants.FEXTRA) != 0) {
261-
// Skip subfield id
262-
for (int i=0; i< 2; i++) {
263-
int readByte = inputBuffer.ReadLeByte();
264-
if (readByte < 0) {
265-
throw new EndOfStreamException("EOS reading GZIP header");
266-
}
267-
headCRC.Update(readByte);
268-
}
269-
270-
if (inputBuffer.ReadLeByte() < 0 || inputBuffer.ReadLeByte() < 0) {
271-
throw new EndOfStreamException("EOS reading GZIP header");
272-
}
273261

262+
// XLEN is total length of extra subfields, we will skip them all
274263
int len1, len2;
275264
len1 = inputBuffer.ReadLeByte();
276265
len2 = inputBuffer.ReadLeByte();

0 commit comments

Comments
 (0)