You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2019/08/09 04:34:39 UTC

svn commit: r1864754 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java

Author: tilman
Date: Fri Aug  9 04:34:39 2019
New Revision: 1864754

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

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java?rev=1864754&r1=1864753&r2=1864754&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java Fri Aug  9 04:34:39 2019
@@ -165,7 +165,11 @@ public class CmapSubtable implements Cma
                 // -- Convert the Character code in decimal
                 if (j > Integer.MAX_VALUE)
                 {
-                    throw new IOException("[Sub Format 8] Invalid Character code");
+                    throw new IOException("[Sub Format 8] Invalid character code " + j);
+                }
+                if ((int) j / 8 == is32.length)
+                {
+                    throw new IOException("[Sub Format 8] Invalid character code " + j);
                 }
 
                 int currentCharCode;
@@ -183,7 +187,7 @@ public class CmapSubtable implements Cma
                     long codepoint = (lead << 10) + trail + SURROGATE_OFFSET;
                     if (codepoint > Integer.MAX_VALUE)
                     {
-                        throw new IOException("[Sub Format 8] Invalid Character code");
+                        throw new IOException("[Sub Format 8] Invalid character code " + codepoint);
                     }
                     currentCharCode = (int) codepoint;
                 }