1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-03 01:29:39 +02:00

Fix testing a 8-bit integer instead of a 32-bit integer in PSL library

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2002

The code was testing only the LSB of a 32-bit integer to detect
whether the current rule was a wildcard (`*`), while it had to
compare against the whole 32-bit integer.

The breakage occurred when the LSB of an offset to the character
buffer happened to match the ASCII code of `*` (42, 0x2A).

(An offset is used when a label is longer than 4 characters)
This commit is contained in:
Raymond Hill 2022-02-22 18:53:50 -05:00
parent 03b5ad1df2
commit 38855b1ff6
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 2 additions and 2 deletions

View File

@ -403,7 +403,7 @@ const getPublicSuffixPosJS = function() {
}
// 2. If no rules match, the prevailing rule is "*".
if ( iFound === 0 ) {
if ( buf8[iCandidates + 1 << 2] !== 0x2A /* '*' */ ) { break; }
if ( buf8[iCandidates + 1] !== 0x2A /* '*' */ ) { break; }
buf8[SUFFIX_NOT_FOUND_SLOT] = 1;
iFound = iCandidates;
}

View File

@ -255,7 +255,7 @@
i32.eqz
if
get_local $iCandidates
i32.load8_u offset=4
i32.load offset=4
i32.const 0x2A
i32.ne
br_if $labelLookupDone