changeset 7071:3afb6e3979d5

RT-37172: [Font] AIOOB exception in text layout code with multi-byte chars
author Felipe Heidrich <felipe.heidrich@oracle.com>
date Fri, 16 May 2014 15:33:05 -0700
parents 674e7c021c37
children bd6df46d91c9
files modules/graphics/src/main/java/com/sun/javafx/font/directwrite/DWGlyphLayout.java
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/javafx/font/directwrite/DWGlyphLayout.java	Mon May 19 12:43:37 2014 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/font/directwrite/DWGlyphLayout.java	Fri May 16 15:33:05 2014 -0700
@@ -194,9 +194,10 @@
         int[] indices = new int[glyphCount];
         Arrays.fill(indices, -1);
         for (int i = 0; i < clusterMap.length; i++) {
+            int index = clusterMap[i];
             /* keep character offset for the first glyph in the cluster */
-            if (indices[clusterMap[i]] == -1) {
-                indices[clusterMap[i]] = i;
+            if (0 <= index && index < glyphCount && indices[index] == -1) {
+                indices[index] = i;
             }
         }
         if (indices.length > 0) {