pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1643161 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/type1/Type1Parser.java
Date Fri, 05 Dec 2014 06:52:52 GMT
Author: tilman
Date: Fri Dec  5 06:52:52 2014
New Revision: 1643161

URL: http://svn.apache.org/viewvc?rev=1643161&view=rev
Log:
PDFBOX-2540: avoid ArrayIndexOutOfBoundsException if font is empty

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/type1/Type1Parser.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/type1/Type1Parser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/type1/Type1Parser.java?rev=1643161&r1=1643160&r2=1643161&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/type1/Type1Parser.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/type1/Type1Parser.java Fri Dec 
5 06:52:52 2014
@@ -67,13 +67,13 @@ final class Type1Parser
     }
 
     /**
-     * Parses the ASCII porition of a Type 1 font.
+     * Parses the ASCII portion of a Type 1 font.
      */
     private void parseASCII(byte[] bytes) throws IOException
     {
         // %!FontType1-1.0
         // %!PS-AdobeFont-1.0
-        if (bytes[0] != '%' && bytes[1] != '!')
+        if (bytes.length < 2 || (bytes[0] != '%' && bytes[1] != '!'))
         {
             throw new IOException("Invalid start of ASCII segment");
         }



Mime
View raw message