Skip to content

Commit 3fe977a

Browse files
Merge pull request #600 from 0f-0b/uncompressed-size
Fix edge cases of uncompressed size check
2 parents 0b0127f + e691c55 commit 3fe977a

14 files changed

Lines changed: 23 additions & 22 deletions

dist/zip-core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,7 +2877,7 @@
28772877
if (chunk && chunk.length) {
28782878
controller.enqueue(chunk);
28792879
codec.outputSize += chunk.length;
2880-
if (options.outputSize && codec.outputSize > options.outputSize) {
2880+
if (options.outputSize !== UNDEFINED_VALUE && codec.outputSize > options.outputSize) {
28812881
throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
28822882
}
28832883
}
@@ -4020,7 +4020,7 @@
40204020
encryptionStrength: extraFieldAES && extraFieldAES.strength,
40214021
signed: getOptionValue$1(zipEntry, options, OPTION_CHECK_SIGNATURE) && !passThrough,
40224022
passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & 0xFF) : ((signature >>> 24) & 0xFF)),
4023-
outputSize: uncompressedSize,
4023+
outputSize: passThrough ? compressedSize : uncompressedSize,
40244024
signature,
40254025
compressed: compressionMethod != 0 && !passThrough,
40264026
encrypted: zipEntry.encrypted && !passThrough,

dist/zip-core.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zip-fs-core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,7 +2877,7 @@
28772877
if (chunk && chunk.length) {
28782878
controller.enqueue(chunk);
28792879
codec.outputSize += chunk.length;
2880-
if (options.outputSize && codec.outputSize > options.outputSize) {
2880+
if (options.outputSize !== UNDEFINED_VALUE && codec.outputSize > options.outputSize) {
28812881
throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
28822882
}
28832883
}
@@ -4020,7 +4020,7 @@
40204020
encryptionStrength: extraFieldAES && extraFieldAES.strength,
40214021
signed: getOptionValue$1(zipEntry, options, OPTION_CHECK_SIGNATURE) && !passThrough,
40224022
passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & 0xFF) : ((signature >>> 24) & 0xFF)),
4023-
outputSize: uncompressedSize,
4023+
outputSize: passThrough ? compressedSize : uncompressedSize,
40244024
signature,
40254025
compressed: compressionMethod != 0 && !passThrough,
40264026
encrypted: zipEntry.encrypted && !passThrough,

dist/zip-fs-core.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zip-fs.js

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

dist/zip-fs.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zip-web-worker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zip.js

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

dist/zip.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.cjs

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)