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

fix(android): prevent crash on script injection if the script is too long #7308

Merged

Conversation

ryaa
Copy link
Contributor

@ryaa ryaa commented Mar 4, 2024

closes #7309

@jcesarmobile jcesarmobile changed the title bugfix: Application crashes on Android after upgrading to the latest 5.7.1 version fix(android): prevent crash on script injection if the script is too long Mar 5, 2024
@dabaaaz

This comment was marked as abuse.

@dodomui
Copy link

dodomui commented Mar 6, 2024

This doesn't fix my problem.
Tried downgrade to 5.7.0 / 5.6.0. Still crash on launching.

below is the new error after applied above coding update.

java.lang.IllegalArgumentException: No capturing group in the pattern with the name Date.now()
                                                                                                    	at java.util.regex.Matcher.getMatchedGroupIndex(Matcher.java:1197)
                                                                                                    	at java.util.regex.Matcher.group(Matcher.java:492)
                                                                                                    	at java.util.regex.Matcher.appendEvaluated(Matcher.java:753)
                                                                                                    	at java.util.regex.Matcher.appendReplacement(Matcher.java:717)
                                                                                                    	at java.util.regex.Matcher.replaceFirst(Matcher.java:892)
                                                                                                    	at java.lang.String.replaceFirst(String.java:2269)
                                                                                                    	at com.getcapacitor.JSInjector.getInjectedStream(JSInjector.java:75)
                                                                                                    	at com.getcapacitor.WebViewLocalServer.handleLocalRequest(WebViewLocalServer.java:411)
                                                                                                    	at com.getcapacitor.WebViewLocalServer.shouldInterceptRequest(WebViewLocalServer.java:201)
                                                                                                    	at com.getcapacitor.BridgeWebViewClient.shouldInterceptRequest(BridgeWebViewClient.java:23)
                                                                                                    	at WV.d6.a(chromium-TrichromeWebViewGoogle.aab-stable-626106431:86)
                                                                                                    	at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(chromium-TrichromeWebViewGoogle.aab-stable-626106431:15)

Any solution?

@dabaaaz
Copy link

dabaaaz commented Mar 6, 2024

@dodomui did you changed all the lines like the full MR https://github.com/ionic-team/capacitor/pull/7308/files ?

@ryaa
Copy link
Contributor Author

ryaa commented Mar 6, 2024

below is the new error after applied above coding update.

The error seems to be thrown from replaceFirst method (see at java.lang.String.replaceFirst(String.java:2269) in the stack trace), so it does not seem that the required changes are there

@jcesarmobile jcesarmobile merged commit c9895e8 into ionic-team:main Mar 6, 2024
6 checks passed
jcesarmobile added a commit that referenced this pull request Mar 6, 2024
@dodomui
Copy link

dodomui commented Mar 13, 2024

No more issue with 5.7.2.
Thanks.

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

Successfully merging this pull request may close these issues.

[Bug]: Application crashes on Android after upgrading to the latest 5.7.1 version
5 participants