Skip to content

Commit

Permalink
Fix cosmetic matching (tokenization bug)
Browse files Browse the repository at this point in the history
  • Loading branch information
remusao committed Dec 3, 2018
1 parent 7167736 commit fe366c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

*not released yet*

* Fix cosmetic matching (tokenization bug) [#65](https://github.com/cliqz-oss/adblocker/pull/65)
* Optimize serialization and properly handle unicode in filters [#61](https://github.com/cliqz-oss/adblocker/pull/61)

## 0.3.1

*2018-11-29*

* Optimize serialization and properly handle unicode in filters [#61](https://github.com/cliqz-oss/adblocker/pull/61)
* Fix fuzzy matching by allowing tokens of any size [#61](https://github.com/cliqz-oss/adblocker/pull/62)
* Fix fuzzy matching by allowing tokens of any size [#62](https://github.com/cliqz-oss/adblocker/pull/62)
* Add support for CSP (Content Security Policy) filters [#60](https://github.com/cliqz-oss/adblocker/pull/60)
* Add hard-coded circumvention logic (+ IL defuser) [#59](https://github.com/cliqz-oss/adblocker/pull/59)
- Simplify 'example' extension
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function fastTokenizerNoRegex(
tokensBufferIndex += 1;
}

return TOKENS_BUFFER.subarray(0, tokensBufferIndex);
return TOKENS_BUFFER.slice(0, tokensBufferIndex);
}

function fastTokenizer(pattern: string, isAllowedCode: (ch: number) => boolean): Uint32Array {
Expand All @@ -187,7 +187,7 @@ function fastTokenizer(pattern: string, isAllowedCode: (ch: number) => boolean):
tokensBufferIndex += 1;
}

return TOKENS_BUFFER.subarray(0, tokensBufferIndex);
return TOKENS_BUFFER.slice(0, tokensBufferIndex);
}

export function tokenize(pattern: string): Uint32Array {
Expand Down

0 comments on commit fe366c9

Please sign in to comment.