Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some RegExp filters are not parsed properly #1038

Closed
6 of 8 tasks
jspenguin2017 opened this issue May 16, 2020 · 7 comments
Closed
6 of 8 tasks

Some RegExp filters are not parsed properly #1038

jspenguin2017 opened this issue May 16, 2020 · 7 comments
Labels
bug Something isn't working fixed issue has been addressed

Comments

@jspenguin2017
Copy link

Prerequisites

  • I verified that this is not a filter issue
  • This is not a support issue or a question
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
    • Your issue may already be reported.
  • I tried to reproduce the issue when...
    • uBlock Origin is the only extension
    • uBlock Origin with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uBlock Origin
  • I checked the documentation to understand that the issue I report is not a normal behavior

Description

This EasyList filter is not parsed properly. An error is logged to the background console instead:

/^https:\/\/([a-z]+\.)?sythe\.org\/\[=%#@$&!^].*[\w\W]{20,}/$image

image

The RegExp is kind of weird, but nevertheless is a valid RegExp.
image

A specific URL where the issue occurs

chrome://extensions/

Steps to Reproduce

  1. Update EasyList or add the filter above to my filters

Expected behavior:

Filter parsed correctly.

Actual behavior:

Error logged to the background console.

Your environment

  • uBlock Origin version: 1.27.2
  • Browser Name and version: Chrome 84.0.4143.7
  • Operating System and version: Windows 10.0.18363.778
@uBlock-user uBlock-user added the bug Something isn't working label May 16, 2020
@kulfoon
Copy link

kulfoon commented May 17, 2020

jspenguin2017 : The RegExp is kind of weird, but nevertheless is a valid RegExp.
image

Yes, while it's still a technically valid regex it seems that what you're calling "weird" is a bug (a typo) - an unwanted excape char \ in the middle - should be /[ and not /\[, coz I don't think that the author or anybody else wanted to escape [ in that place, he simply wanted to pick any character between [] square brackets, which (the square brackets) should not be escaped in this case, so the intended regex would be: /^https:\/\/([a-z]+\.)?sythe\.org\/[=%#@$&!^].*[\w\W]{20,}/$image

Seems lika a bug in uBO, because the fixed version of the regex not working in uBO as well:
/^https:\/\/([a-z]+\.)?sythe\.org\/[=%#@$&!^].*[\w\W]{20,}/$image
it should match and block this example request:
https://xxx.sythe.org/&xderf45tghyt56yhjuikjuytrf.jpg (LINK TO TEST)
but the logger shows it's not blocked.

The bug in uBO is about distinguishing between cosmetic filters - which contain ## or #@ and regex filters which might occasionally contain the same.

@gwarser
Copy link

gwarser commented May 17, 2020

It's just parser error. Swap #@ in place and it will work. Simple example [of filter which does not work]:

/#@/

@gorhill
Copy link
Member

gorhill commented May 17, 2020

I fixed it yesterday locally, but for the next dev cycle I had planned to rewrite and separate FilterParser from static network filtering engine (so that it can be loaded separately in auxiliary pages for example), so it's probably going to be fixed as part of the rewrite.

@kulfoon
Copy link

kulfoon commented May 17, 2020

gwarser : Simple example : /#@/

This won't work either, you have a typo in the example, you actually didn't swap it, you meant: /@#/

We got 3 bugs/typos already: Typo in the regex, a bug in uBO parser, and a typo in the comment, but hey - no offence, Human beings make mistakes.

@gwarser
Copy link

gwarser commented May 17, 2020

This is simplest example of filter which does not work.

@uBlock-user
Copy link
Contributor

We got 3 bugs/typos already: Typo in the regex, a bug in uBO parser, and a typo in the comment

Because of lack of installation of dev-builds to catch these bugs. Had more people installed devbuilds, this would have been caught before the stable release occurred.

@kulfoon
Copy link

kulfoon commented May 17, 2020

gwarser : This is simplest example of filter which does not work.

Ok then, good to know, coz your previous comment looks confusing, it looks more like you wanted to provide the simplest example of filter which does work, especially after placing the example after previously suggesting swapping and providing an identical example, why duplicating the example then.

@uBlockOrigin uBlockOrigin locked as spam and limited conversation to collaborators May 17, 2020
szphie added a commit to szphie/easylist that referenced this issue May 17, 2020
@uBlock-user uBlock-user added the fixed issue has been addressed label Jun 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working fixed issue has been addressed
Projects
None yet
Development

No branches or pull requests

5 participants