JDK-8249964 : Text with both supplementary characters and ZWJ characters displays junk
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: openjfx14
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2020-07-13
  • Updated: 2020-07-23
  • Resolved: 2020-07-17
Related Reports
Relates :  
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



Comments
OS: Linux JDK 14.0.1 OpenJFX 14 Issue existed in JavaFX 14, asked submitter to verify in JavaFX15 ea. Reply from submitter: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< It appears the issue is fixed in JavaFX 15 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Closing as duplicate of JDK-8246348
17-07-2020

This is a possible duplicate of JDK-8246348.
14-07-2020