abp-filter-parser
abp-filter-parser copied to clipboard
Fix bad regex check
Using indexOf will break, if a regex contains $. lastIndexOf will solve the problem.
Hello @bbondy, what about this fix? Latest easylist contains such regular expressions.
This does not fix the problem (or rather creates a new one). Consider this:
"||optimizely.com^$third-party".indexOf('$',0)//17
"||optimizely.com^$third-party".lastIndexOf('$', 0);//-1
Second parameter is to blame here. It works differently for indexOf and lastIndexOf.
We have 3 cases here:
/\.cricket\/[0-9]{2,9}\/$/$script,stylesheet,third-party,xmlhttprequest- regex $ + options/$file/analytics.- regex $, no options&refer=http$script- no regex, options