Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Trying to access beyond buffer length #16

Closed
monkeycraps opened this issue Jan 8, 2014 · 2 comments
Closed

RangeError: Trying to access beyond buffer length #16

monkeycraps opened this issue Jan 8, 2014 · 2 comments

Comments

@monkeycraps
Copy link

for a zip file with 273 files, it emit such an error.
is there any way to deal with?

on the side, is there a function get zip entry as java zip lib?

thanks for reply

@monkeycraps
Copy link
Author

hi, i found it is a bug when extra filed is less then 4 bytes:

when u parsing entity with function structures.readFileEntity

u caculate the extra as follow
fileEntry.extraField = parseExtraFields(buffer.slice(index, index + fileEntry.extraFieldLength));

which will do as bellow, for the extra field witch is less then 4 bytes, it will throw error as issue title

`
var parseExtraFields = function (buffer) {
var index = 0;

var fields = {};

while (index < buffer.length) {
    var header = buffer.readUInt16LE(index);
    var length = buffer.readUInt16LE(index + 2);
    var field = buffer.slice(index + 4, index + 4 + length);

    // TODO: Actually do something with this data
    fields[header] = field;

    index += length + 4;
}

return fields;

};
`

@wibblymat
Copy link
Member

It looks like you are using an out of date version. Could you try it on the same zip with version 0.0.3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants