forked from cthackers/adm-zip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cthackers#483 from criyle/disk_entries
zipFile: add check for invalid large disk entries
- Loading branch information
Showing
4 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"use strict"; | ||
|
||
const assert = require("assert"); | ||
const path = require("path"); | ||
const Zip = require("../../adm-zip"); | ||
|
||
describe("read zip file header with invalid large number of entries", () => { | ||
it("throws too large error", () => { | ||
// this zip file reports 2147483648 disk entry count which is impossible | ||
const zip = new Zip(path.join(__dirname, "../assets/large_directory_size.zip")); | ||
// assert that the following call throws an exception | ||
assert.throws(() => { | ||
zip.getEntries(); | ||
}, new Error("Number of disk entries is too large")); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters