Fix token array being too small for very long URL

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.
This commit is contained in:
Raymond Hill 2019-11-22 18:22:21 -05:00
parent 18b6a6ba18
commit bddd4a67ca
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -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();