fix: Gzip comment with header checksum produces corrupt streams (#2288)

This commit is contained in:
Willi Ballenthin
2026-06-20 09:03:12 +01:00
committed by GitHub
parent 0a0d95bcbd
commit 8105e3eb07
2 changed files with 61 additions and 3 deletions
+1 -3
View File
@@ -74,13 +74,11 @@ class Gzip extends Operation {
}
if (comment.length) {
options.flags.comment = true;
options.flags.fcomment = true;
options.comment = comment;
}
const gzipObj = new Zlib.Gzip(new Uint8Array(input), options);
const compressed = new Uint8Array(gzipObj.compress());
if (options.flags.comment && !(compressed[3] & 0x10)) {
compressed[3] |= 0x10;
}
return compressed.buffer;
}