1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-09 20:32:39 +01:00

Fix selfie with invalid data in some circumstances

Reported internally.

The issue involves `removeparam` filters with a regex value. When
such filter was visited before a selfie was created, this would cause
the created selfie to persist a RegExp object, which can't be
serialized. This would cause exceptions to be thrown when uBO would
be subsequently loaded with the tainted selfie, since uBO would try
to execute a plain Object as a RegExp.
This commit is contained in:
Raymond Hill 2022-01-11 11:06:11 -05:00
parent 9b22961291
commit 8f461072f5
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1645,7 +1645,7 @@ const FilterModifier = class {
filterData[idata+2] = args[2]; // type filterData[idata+2] = args[2]; // type
filterData[idata+3] = filterRefAdd({ filterData[idata+3] = filterRefAdd({
value: args[3], value: args[3],
cache: null, $cache: null,
}); });
return idata; return idata;
} }
@ -1694,11 +1694,11 @@ const FilterModifierResult = class {
} }
get cache() { get cache() {
return this.refs.cache; return this.refs.$cache;
} }
set cache(a) { set cache(a) {
this.refs.cache = a; this.refs.$cache = a;
} }
logData() { logData() {
@ -3523,7 +3523,7 @@ FilterCompiler.prototype.FILTER_UNSUPPORTED = 2;
const FilterContainer = function() { const FilterContainer = function() {
this.compilerVersion = '8'; this.compilerVersion = '8';
this.selfieVersion = '8'; this.selfieVersion = '9';
this.MAX_TOKEN_LENGTH = MAX_TOKEN_LENGTH; this.MAX_TOKEN_LENGTH = MAX_TOKEN_LENGTH;
this.optimizeTaskId = undefined; this.optimizeTaskId = undefined;