Skip to content

Commit

Permalink
ignore 'unexpected EOF' in Extra Field buffer. closes #31
Browse files Browse the repository at this point in the history
  • Loading branch information
thejoshwolfe committed Jun 8, 2016
1 parent a525eed commit 61c40fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@ ZipFile.prototype.readEntry = function() {
var extraFieldBuffer = buffer.slice(entry.fileNameLength, fileCommentStart);
entry.extraFields = [];
var i = 0;
while (i < extraFieldBuffer.length) {
if (i >= extraFieldBuffer.length - 4) return emitErrorAndAutoClose(self, new Error("unexpected end of Extra Field buffer"));
while (i < extraFieldBuffer.length - 3) {
var headerId = extraFieldBuffer.readUInt16LE(i + 0);
var dataSize = extraFieldBuffer.readUInt16LE(i + 2);
var dataStart = i + 4;
Expand Down
Binary file removed test/failure/unexpected end of Extra Field buffer.zip
Binary file not shown.

0 comments on commit 61c40fd

Please sign in to comment.