CRC calculation was broken on some files (particularly empty ones)
+3
-3
Diff
round #0
+3
-3
lib/zip.ts
+3
-3
lib/zip.ts
···
70
70
crc = CRC32_TABLE[(crc ^ chunk[idx]) & 0xff] ^ (crc >>> 8);
71
71
}
72
72
73
-
return crc ^ -1;
73
+
return crc;
74
74
}
75
75
76
76
function unixToDosTime(unixTimestamp: number): { time: number; date: number } {
···
249
249
// 8 - compressed size
250
250
// 12 - uncompressed size
251
251
writeUint32LE(view, 0, 0x08074b50);
252
-
writeUint32LE(view, 4, crc);
252
+
writeUint32LE(view, 4, ~crc);
253
253
writeUint32LE(view, 8, compressedSize);
254
254
writeUint32LE(view, 12, uncompressedSize);
255
255
···
290
290
writeUint16LE(view, 10, method);
291
291
writeUint16LE(view, 12, dosTime);
292
292
writeUint16LE(view, 14, dosDate);
293
-
writeUint32LE(view, 16, crc);
293
+
writeUint32LE(view, 16, ~crc);
294
294
writeUint32LE(view, 20, compressedSize);
295
295
writeUint32LE(view, 24, uncompressedSize);
296
296
writeUint16LE(view, 28, fnameLen);
History
1 round
0 comments
decahedron.pyke.io
submitted
#0
patch application failed: error: patch failed: lib/zip.ts:70
error: lib/zip.ts: patch does not apply