Skip to content

Commit

Permalink
Fix token array being too small for very long URL
Browse files Browse the repository at this point in the history
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/dzw57l/

Each token requires two slots in the token indices
array. This commit fixes uBO breaking when dealing
with very long URLs with lot of distinct tokens in
them.
  • Loading branch information
gorhill committed Nov 23, 2019
1 parent ff91870 commit 1b068c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
this._urlIn = '';
this._urlOut = '';
this._tokenized = false;
this._tokens = new Uint32Array(1024);
// https://www.reddit.com/r/uBlockOrigin/comments/dzw57l/
// Remember: 1 token needs two slots
this._tokens = new Uint32Array(2064);

this.knownTokens = new Uint8Array(65536);
this.resetKnownTokens();
Expand Down

0 comments on commit 1b068c1

Please sign in to comment.