pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1864633 - /pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java
Date Wed, 07 Aug 2019 16:22:55 GMT
Author: tilman
Date: Wed Aug  7 16:22:55 2019
New Revision: 1864633

URL: http://svn.apache.org/viewvc?rev=1864633&view=rev
Log:
PDFBOX-4622: avoid ArrayIndexOutOfBoundsException

Modified:
    pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java

Modified: pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java?rev=1864633&r1=1864632&r2=1864633&view=diff
==============================================================================
--- pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java
(original)
+++ pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java
Wed Aug  7 16:22:55 2019
@@ -134,13 +134,21 @@ public class PostScriptTable extends TTF
             glyphNames = new String[glyphNameIndex.length];
             for (int i = 0; i < glyphNames.length; i++)
             {
-                String name = WGL4Names.MAC_GLYPH_NAMES[glyphNameIndex[i]];
-                if (name != null)
+                int index = glyphNameIndex[i];
+                if (index >= 0 && index < WGL4Names.NUMBER_OF_MAC_GLYPHS)
                 {
-                    glyphNames[i] = name;
+                    String name = WGL4Names.MAC_GLYPH_NAMES[index];
+                    if (name != null)
+                    {
+                        glyphNames[i] = name;
+                    }
+                }
+                else
+                {
+                    LOG.debug("incorrect glyph name index " + index +
+                              ", valid numbers 0.." + WGL4Names.NUMBER_OF_MAC_GLYPHS);
                 }
             }
-
         }
         else if (Float.compare(formatType, 3.0f) == 0)
         {



Mime
View raw message