1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00
This commit is contained in:
gorhill 2017-01-09 08:56:42 -05:00
parent 693758aacb
commit 9c4fbeb1fc

View File

@ -1134,6 +1134,7 @@ FilterBucket.fromSelfie = function() {
var FilterParser = function() {
this.cantWebsocket = vAPI.cantWebsocket;
this.reBadDomainOptChars = /[*+?^${}()[\]\\]/;
this.reHostnameRule1 = /^[0-9a-z][0-9a-z.-]*[0-9a-z]$/i;
this.reHostnameRule2 = /^\**[0-9a-z][0-9a-z.-]*[0-9a-z]\^?$/i;
this.reCleanupHostnameRule2 = /^\**|\^$/g;
@ -1285,8 +1286,15 @@ FilterParser.prototype.parseOptions = function(s) {
}
continue;
}
// https://github.com/gorhill/uBlock/issues/2294
// Detect and discard filter if domain option contains nonsensical
// characters.
if ( opt.startsWith('domain=') ) {
this.domainOpt = opt.slice(7);
if ( this.reBadDomainOptChars.test(this.domainOpt) ) {
this.unsupported = true;
break;
}
continue;
}
if ( opt === 'important' ) {
@ -1824,7 +1832,7 @@ FilterContainer.prototype.compile = function(raw, out) {
// Ignore filters with unsupported options
if ( parsed.unsupported ) {
//console.log('static-net-filtering.js > FilterContainer.add(): unsupported filter "%s"', raw);
µb.logger.writeOne('', 'error', 'Network filtering invalid filter: ' + raw);
return false;
}