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:34 UTC

svn commit: r1864753 - /pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java

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

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

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

Modified: pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java?rev=1864753&r1=1864752&r2=1864753&view=diff
==============================================================================
--- pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java (original)
+++ pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java Fri Aug  9 04:34:34 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;
                 }