1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00

Prevent reverse-lookup from finding badfilter-ed filters

This could occur when clicking old entries in the logger
which no longer matched the internal state of uBO.

Related feedback:
- https://github.com/MajkiIT/polish-ads-filter/issues/14768#issuecomment-536006312
This commit is contained in:
Raymond Hill 2019-09-30 08:53:02 -04:00
parent 23b6f35893
commit e1d75ee602
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -49,6 +49,9 @@ const extractBlocks = function(content, begId, endId) {
/******************************************************************************/
// https://github.com/MajkiIT/polish-ads-filter/issues/14768#issuecomment-536006312
// Avoid reporting badfilter-ed filters.
const fromNetFilter = function(details) {
const lists = [];
const compiledFilter = details.compiledFilter;
@ -56,7 +59,7 @@ const fromNetFilter = function(details) {
for ( const assetKey in listEntries ) {
const entry = listEntries[assetKey];
if ( entry === undefined ) { continue; }
const content = extractBlocks(entry.content, 0, 1000);
const content = extractBlocks(entry.content, 0, 0);
let pos = 0;
for (;;) {
pos = content.indexOf(compiledFilter, pos);