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

java.util.regex.PatternSyntaxException: Unrecognized backslash escape sequence in pattern near index 41 #5338

Closed
chaoscalm opened this issue May 11, 2020 · 3 comments

Comments

@chaoscalm
Copy link

5-11 13:36:57.394 E/AndroidRuntime( 4480): Process: com.stoutner.privacybrowser.standard, PID: 4480
05-11 13:36:57.394 E/AndroidRuntime( 4480): java.util.regex.PatternSyntaxException: Unrecognized backslash escape sequence in pattern near index 41
05-11 13:36:57.394 E/AndroidRuntime( 4480): /https?://..streamplay.biz/.(?|&|
05-11 13:36:57.394 E/AndroidRuntime( 4480): ^
05-11 13:36:57.394 E/AndroidRuntime( 4480): at java.util.regex.Pattern.compileImpl(Native Method)
05-11 13:36:57.394 E/AndroidRuntime( 4480): at java.util.regex.Pattern.compile(Pattern.java:1433)
05-11 13:36:57.394 E/AndroidRuntime( 4480): at java.util.regex.Pattern.(Pattern.java:1408)
05-11 13:36:57.394 E/AndroidRuntime( 4480): at java.util.regex.Pattern.compile(Pattern.java:966)
05-11 13:36:57.394 E/AndroidRuntime( 4480): at java.util.regex.Pattern.matches(Pattern.java:1074)
05-11 13:36:57.394 E/AndroidRuntime( 4480): at b.b.a.f.c.a(Unknown Source:4303)
05-11 13:36:57.394 E/AndroidRuntime( 4480): at com.stoutner.privacybrowser.activities.MainWebViewActivity$d.shouldInterceptRequest(Unknown Source:529)
05-11 13:36:57.394 E/AndroidRuntime( 4480): at android.webkit.WebViewClient.shouldInterceptRequest(WebViewClient.java:227)
05-11 13:36:57.394 E/AndroidRuntime( 4480): at ib.a(PG:15)
05-11 13:36:57.394 E/AndroidRuntime( 4480): at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(PG:2)
05-11 13:36:57.443 E/cr_AwBgThreadClient( 4480): Client raised exception in shouldInterceptRequest. Re-throwing on UI thread.
05-11 13:36:57.481 E/cr_AwBgThreadClient( 4480): Client raised exception in shouldInterceptRequest. Re-throwing on UI thread.
05-11 13:36:57.513 E/cr_AwBgThreadClient( 4480): Client raised exception in shouldInterceptRequest. Re-throwing on UI thread.
05-11 13:36:57.544 E/cr_AwBgThreadClient( 4480): Client raised exception in shouldInterceptRequest. Re-throwing on UI thread.
05-11 13:36:57.566 E/cr_AwBgThreadClient( 4480): Client raised exception in shouldInterceptRequest. Re-throwing on UI thread.
05-11 13:36:57.567 E/cr_AwBgThreadClient( 4480): Client raised exception in shouldInterceptRequest. Re-throwing on UI thread.

There are two kind of these regex currently used inside easylist:

/^https?:\/\/.*powvideo\.net\/.*(\?|&|\$|=|&|!)/$script,subdocument /^https?:\/\/.*.streamplay\.biz\/.*(\?|&|\$|=|&|!)/$script,subdocument

Could be them fixed in order to avoid java.util.regex.PatternSyntaxException ?

@DandelionSprout
Copy link
Contributor

DandelionSprout commented May 11, 2020

While I have less than zero experience with Privacy Browser, I presume that changing (\?|&|\$|=|&|!) into ([?&$=!]) or even simply [?&$=!] would be worth for the EasyList team to try out.

DandelionSprout added a commit to DandelionSprout/easylist that referenced this issue May 11, 2020
@sorenstoutner
Copy link

I am the developer of Privacy Browser. The problem is caused because the parser used by Privacy Browser considers any $ to mark the end of the URL and the beginning of the EasyList types. These two newly-added entries both contain two $. This causes the parser to truncate the regular expression, resulting in a regular expression pattern compile error.

Looking at the regular expression, I have a hard time imagining that any of the URLs you are trying to block actually contain a $. It looks more like someone copied some syntax meant to catch all strings, and ended up including it here even though the $ is not needed.

@ryanbr
Copy link
Member

ryanbr commented May 13, 2020

Should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants