pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1864755 - /pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java
Date Fri, 09 Aug 2019 04:34:44 GMT
Author: tilman
Date: Fri Aug  9 04:34:44 2019
New Revision: 1864755

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

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

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



Mime
View raw message