Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8249964

Text with both supplementary characters and ZWJ characters displays junk

    XMLWordPrintable

Details

    • x86_64
    • linux

    Description

      ADDITIONAL SYSTEM INFORMATION :
      $ uname -a
      Linux ceres 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2 (2020-04-29) x86_64 GNU/Linux

      $ java -version
      openjdk version "14.0.1" 2020-04-14
      OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.1+7)
      OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.1+7, mixed mode, sharing)

      JavaFX 14.0.1

      Gnome 3.30.2


      A DESCRIPTION OF THE PROBLEM :
      Displaying a javafx.scene.text.Text which contains supplementary characters mixed with zero width joiner characters ('\u200d') appears to cause a buffer boundary issue in Linux. Visually, this manifests as garbage characters which appear after the last program-supplied character.

      If several such Text objects are displayed together, not only do they all exhibit the problem, the likelihood of a SIGSEGV in libpango-1.0.so.0 increases.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Display one or more Text nodes which contain supplementary characters with ZWJ characters between them.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The Text nodes should display only the characters given to them in the program.
      ACTUAL -
      Displaying one such Text node will illustrate the problem: extra “junk” characters appear at the end of the Text that were not specified in the code. Displaying multiple Text nodes will increase the number of junk characters displayed at the end. Displaying twenty in a single Scene is usually enough to cause a SIGSEGV in libpango-1.0.so.0.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.stage.Stage;
      import javafx.scene.Scene;
      import javafx.scene.control.ScrollPane;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.text.Text;
      import javafx.scene.text.TextFlow;

      public class FXTextTest
      extends Application {
          @Override
          public void start(Stage stage) {

              int count = Integer.getInteger("count", 1);

              String line = String.format("(%c%c%c%c%c%c%c)\n\n",
                  0x1F469, 0x1F3FD, 0x200D, 0x1F91D, 0x200D, 0x1F468, 0x1F3FB);

              TextFlow flow = new TextFlow();
              for (int i = 0; i < count; i++) {
                  flow.getChildren().add(new Text(line));
              }

              stage.setScene(new Scene(new BorderPane(new ScrollPane(flow))));
              stage.setTitle("Text Test");
              stage.show();
          }

          public static class Main {
              public static void main(String[] args) {
                  Application.launch(FXTextTest.class, args);
              }
          }
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              sswsharm swati sharma (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: