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

Correctly use Buffer length instead of String length for "Chunking" #762

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions controllers/scriptStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ exports.getMeta = function (aBufs, aCallback) {
var blocks = {};

for (; i < aBufs.length; ++i) {
// Convert the current Buffer to a `String` and accumulate it's `String` totalLength
len += aBufs[i].toString('utf8').length; // NOTE: Watchpoint
// Accumulate the indexed Buffer length to use with `totalLength` parameter
len += aBufs[i].length;

// Read from the start of the Buffers to the `String` length end-point
// Read from the start of the Buffers to the Buffers length end-point
// See also #678
str = Buffer.concat(aBufs, len).toString('utf8');

Expand Down