-
Notifications
You must be signed in to change notification settings - Fork 29.7k
fix emoji in iOS crash #30851
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 emoji in iOS crash #30851
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
I signed it! |
|
Is there an issue open to discuss this? This will need tests. |
|
Also, the CLA bot won't recognize your signed CLA because the commits were authored by a different email address than you're signed in with right now. |
| /// The text before this range. | ||
| String textBefore(String text) { | ||
| assert(isNormalized); | ||
| if(text.isNotEmpty && start > 0 && start < text.length ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: spacing should be if (text.isNotEmpty && start > 0 && start < text.length) {
| String textBefore(String text) { | ||
| assert(isNormalized); | ||
| if(text.isNotEmpty && start > 0 && start < text.length ){ | ||
| final int startCodeUnit = text.codeUnitAt(start); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems dangerous. What if the character is more than a single code unit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://en.wikipedia.org/wiki/UTF-16 @dnfield one character may be two code unit.
| assert(isNormalized); | ||
| if(text.isNotEmpty && start > 0 && start < text.length ){ | ||
| final int startCodeUnit = text.codeUnitAt(start); | ||
| if( startCodeUnit & 0x8C00 == 0x8C00 ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same spacing nit as above. This also seems dangerous - Why are we checking for these specific bits to be set on the first code unit? Are we certain that this impacts all unicode characters with those bits set? Could we somehow document what this magic number means?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this magic number is utf-16 encoding
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
|
I'm not able to reproduce this, and the crash you're seeing seems like it should probably have a fix in the iOS embedding rather than the framework. Can you provide a sample test (maybe a driver test?) that reproduces this issue? |
|
(I ran a simple app on the iOS simulator with a TextField widget, and repeatedly pasted 𐐷) |
Doctor summary (to see all details, run flutter doctor -v): [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) |
|
What are you doing to get the cursor in the middle of the emoji? |
Random click @dnfield |
|
@dnfield may be change iphone language to Chinese Simple , try again. |
https://en.wikipedia.org/wiki/UTF-16 @dnfield one character may be two code units. |
|
Some are 4 code points. I'm trying to find out how to reproduce the crash though. /Cc @GaryQian @goderbauer |
flutter/engine@9e315e6...2e8e96f git log 9e315e6..2e8e96f --no-merges --oneline 2e8e96f Roll Dart to 4eb879133a06c86869dc54cecf904f4b1d46c47b (flutter/engine#6276) 765b0cc Roll src/third_party/skia 060e992ef5b8..1d6281d4bb47 (34 commits) (flutter/engine#6274) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
1.Test code2. environmentdevice:iOS 12 ,iPhone |




Description
*fix in iOS paste emoji crash
Tests
I added the following tests:
Replace this with a list of the tests that you added as part of this PR. A change in behaviour with no test covering it
will likely get reverted accidentally sooner or later. PRs must include tests for all changed/updated/fixed behaviors. See Test Coverage.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?