pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1590749 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/type1/Type1Parser.java
Date Mon, 28 Apr 2014 19:07:17 GMT
Author: tilman
Date: Mon Apr 28 19:07:17 2014
New Revision: 1590749

URL: http://svn.apache.org/r1590749
Log:
PDFBOX-2046: add some leniency to type1 font parser, as suggested by Simon Steiner

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=1590749&r1=1590748&r2=1590749&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 Mon Apr 28
19:07:17 2014
@@ -296,6 +296,11 @@ final class Type1Parser
 
         for (int i = 0; i < length; i++)
         {
+            if (lexer.peekToken().getKind() == Token.NAME
+                    && !lexer.peekToken().getText().equals("end"))
+            {
+                read(Token.NAME);
+            }
             // premature end
             if (lexer.peekToken().getKind() == Token.NAME &&
                     lexer.peekToken().getText().equals("end"))
@@ -483,7 +488,7 @@ final class Type1Parser
             {
                 read(Token.START_PROC);
                 read(Token.NAME, "noaccess");
-                read(Token.NAME, "put");
+                read(Token.NAME);
                 read(Token.END_PROC);
                 read(Token.NAME, "executeonly");
                 read(Token.NAME, "def");
@@ -610,6 +615,12 @@ final class Type1Parser
 
         for (int i = 0; i < length; i++)
         {
+            // premature end
+            if (lexer.peekToken().getKind() == Token.NAME
+                    && lexer.peekToken().getText().equals("end"))
+            {
+                break;
+            }
             // key/value
             String name = read(Token.LITERAL).getText();
 



Mime
View raw message