kevva / kevva/decompress

Exception RangeError: out of range index

Open
#61 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
419
Forks
55
PR merge metrics
No merged PRs in 30d

Description

I got error using `decompress` on AWS Lambda
here is a stack trace when trying to unzip a file, AWS Lambda runs using Node 6.10.

```
at RangeError (native)
at BufferSlicer.read (/var/task/src/handler.js:13590:16)
at readAndAssertNoEof (/var/task/src/handler.js:35297:11)
at ZipFile.readEntry (/var/task/src/handler.js:34927:4)
at Promise (/var/task/src/handler.js:12198:7)
at extractFile (/var/task/src/handler.js:12195:29)
```
Here is the source of the function where line 35297 is for `this.buffer.copy`
```
BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) {
var end = position + length;
var delta = end - this.buffer.length;
var written = (delta > 0) ? delta : length;
this.buffer.copy(buffer, offset, position, end);
setImmediate(function() {
callback(null, written);
});
};
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the unzip failure in AWS Lambda with Node 6.10 and trace the reported BufferSlicer.read call in handler.js, especially the this.buffer.copy operation. Compare the failing input and read positions with the BufferSlicer and ZipFile stack frames; done means identifying the out-of-range condition and confirming the error no longer occurs for the reported archive.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.