pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1783527 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type2CharString.java
Date Sat, 18 Feb 2017 12:44:56 GMT
Author: tilman
Date: Sat Feb 18 12:44:56 2017
New Revision: 1783527

URL: http://svn.apache.org/viewvc?rev=1783527&view=rev
Log:
PDFBOX-3693: avoid IllegalArgumentException

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type2CharString.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type2CharString.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type2CharString.java?rev=1783527&r1=1783526&r2=1783527&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type2CharString.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type2CharString.java Sat Feb
18 12:44:56 2017
@@ -223,17 +223,23 @@ public class Type2CharString extends Typ
         } 
         else if ("rcurveline".equals(name))
         {
-            addCommandList(split(numbers.subList(0, numbers.size() - 2), 6),
-                    new CharStringCommand(8));
-            addCommand(numbers.subList(numbers.size() - 2, numbers.size()),
-                    new CharStringCommand(5));
+            if (numbers.size() >= 2)
+            {
+                addCommandList(split(numbers.subList(0, numbers.size() - 2), 6),
+                        new CharStringCommand(8));
+                addCommand(numbers.subList(numbers.size() - 2, numbers.size()),
+                        new CharStringCommand(5));
+            }
         } 
         else if ("rlinecurve".equals(name))
         {
-            addCommandList(split(numbers.subList(0, numbers.size() - 6), 2),
-                    new CharStringCommand(5));
-            addCommand(numbers.subList(numbers.size() - 6, numbers.size()),
-                    new CharStringCommand(8));
+            if (numbers.size() >= 6)
+            {
+                addCommandList(split(numbers.subList(0, numbers.size() - 6), 2),
+                        new CharStringCommand(5));
+                addCommand(numbers.subList(numbers.size() - 6, numbers.size()),
+                        new CharStringCommand(8));
+            }
         } 
         else if ("vvcurveto".equals(name))
         {
@@ -313,7 +319,7 @@ public class Type2CharString extends Typ
 
     private void drawAlternatingCurve(List<Number> numbers, boolean horizontal)
     {
-        while (numbers.size() > 0)
+        while (numbers.size() >= 4)
         {
             boolean last = numbers.size() == 5;
             if (horizontal)
@@ -337,7 +343,7 @@ public class Type2CharString extends Typ
 
     private void drawCurve(List<Number> numbers, boolean horizontal)
     {
-        while (numbers.size() > 0)
+        while (numbers.size() >= 4)
         {
             boolean first = numbers.size() % 4 == 1;
 



Mime
View raw message