-
Notifications
You must be signed in to change notification settings - Fork 458
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
8246348: Crash in libpango on Ubuntu 20.04 with some unicode chars #249
Conversation
A surrogate pair only counts for 1 character (and not for 2). This fixes JDK-8246348
…parate UTF 8 strings for each TextRun
👋 Welcome back jvos! A progress list of the required criteria for merging this PR into |
Add test that will fail on Ubuntu 20.04 if this PR is not applied. The test is currently commented, as PGFont.getResource returns null for fonts in testing.
Webrevs
|
/reviewers 2 |
@kevinrushforth |
modules/javafx.graphics/src/main/java/com/sun/javafx/font/freetype/PangoGlyphLayout.java
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/java/com/sun/javafx/font/freetype/PangoGlyphLayout.java
Outdated
Show resolved
Hide resolved
Instead of a space you could use a ZWNJ U+FEFF. Because that is also the endian-ness |
modules/javafx.graphics/src/main/java/com/sun/javafx/font/freetype/PangoGlyphLayout.java
Show resolved
Hide resolved
modules/javafx.graphics/src/main/java/com/sun/javafx/font/freetype/PangoGlyphLayout.java
Show resolved
Hide resolved
check on 0 char not needed anymore
Once you address the question of storing a null value in the Map, the only remaining question I have is whether to use a LinkedHashMap instead of an ordinary HashMap. In general, I like the predictability of a LinkedHashMap for maps that are iterated, but in this case, I don't feel strongly about it one way or the other. |
Only store the pointer to the utf8 string if its creation was successful
The fix looks good now. As for the test, even if StubFont were updated to provide a real font, the StubToolkit doesn't load Prism (so none of the text rendering code is exercised). Do you think you could instead add a simple test or two in the system tests project instead (maybe one testing UTF16 chars and one with a 0 char)? |
I added a systemtest |
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.
The new test look good. I confirm that it fails without your patch and passes with your patch. I added a few suggestions to bring it in line with current best practices.
tests/system/src/test/java/test/com/sun/javafx/font/freetype/PangoTest.java
Outdated
Show resolved
Hide resolved
tests/system/src/test/java/test/com/sun/javafx/font/freetype/PangoTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/test/java/test/com/sun/javafx/text/TextLayoutTest.java
Outdated
Show resolved
Hide resolved
tests/system/src/test/java/test/com/sun/javafx/font/freetype/PangoTest.java
Outdated
Show resolved
Hide resolved
revert ignored test in :graphics
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.
Looks good.
@johanvos This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type
Since the source branch of this PR was last updated there have been 18 commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge ➡️ To integrate this PR with the above commit message to the |
/integrate |
@johanvos The following commits have been pushed to master since your change was applied:
Your commit was automatically rebased without conflicts. Pushed as commit bf2e972. |
This addresses https://bugs.openjdk.java.net/browse/JDK-8246348
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jfx pull/249/head:pull/249
$ git checkout pull/249