Skip to content

Commit

Permalink
Fix badly computed output size in µBlock.base64.encode()
Browse files Browse the repository at this point in the history
This bug could cause losing 1 to 3 bytes of information
dropped from various internal buffers at encoding time.

Possibly related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/cs1y26/
  • Loading branch information
gorhill committed Aug 22, 2019
1 parent 2974548 commit 708e500
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@
}

encode(arrbuf, arrlen) {
const inputLength = arrlen >>> 2;
const inputLength = (arrlen + 3) >>> 2;
const inbuf = new Uint32Array(arrbuf, 0, inputLength);
const outputLength = this.magic.length + 7 + inputLength * 7;
const outbuf = new Uint8Array(outputLength);
Expand Down

0 comments on commit 708e500

Please sign in to comment.