pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1674143 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator: state/Concatenate.java state/SetMatrix.java text/MoveText.java text/MoveTextSetLeading.java text/SetTextHorizontalScaling.java
Date Thu, 16 Apr 2015 20:03:32 GMT
Author: tilman
Date: Thu Apr 16 20:03:32 2015
New Revision: 1674143

URL: http://svn.apache.org/r1674143
Log:
PDFBOX-2566: delete wrong operand count on more operators

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/state/Concatenate.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/state/SetMatrix.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/MoveText.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/MoveTextSetLeading.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetTextHorizontalScaling.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/state/Concatenate.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/state/Concatenate.java?rev=1674143&r1=1674142&r2=1674143&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/state/Concatenate.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/state/Concatenate.java
Thu Apr 16 20:03:32 2015
@@ -18,6 +18,7 @@ package org.apache.pdfbox.contentstream.
 
 import java.util.List;
 import java.io.IOException;
+import org.apache.pdfbox.contentstream.operator.MissingOperandException;
 
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSNumber;
@@ -35,6 +36,11 @@ public class Concatenate extends Operato
     @Override
     public void process(Operator operator, List<COSBase> arguments) throws IOException
     {
+        if (arguments.size() < 6)
+        {
+            throw new MissingOperandException(operator, arguments);
+        }
+        
         // concatenate matrix to current transformation matrix
         COSNumber a = (COSNumber) arguments.get(0);
         COSNumber b = (COSNumber) arguments.get(1);

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/state/SetMatrix.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/state/SetMatrix.java?rev=1674143&r1=1674142&r2=1674143&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/state/SetMatrix.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/state/SetMatrix.java
Thu Apr 16 20:03:32 2015
@@ -18,11 +18,12 @@ package org.apache.pdfbox.contentstream.
 
 import java.util.List;
 
+import org.apache.pdfbox.contentstream.operator.MissingOperandException;
+import org.apache.pdfbox.contentstream.operator.Operator;
+import org.apache.pdfbox.contentstream.operator.OperatorProcessor;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSNumber;
 import org.apache.pdfbox.util.Matrix;
-import org.apache.pdfbox.contentstream.operator.Operator;
-import org.apache.pdfbox.contentstream.operator.OperatorProcessor;
 
 /**
  * Tm: Set text matrix and text line matrix.
@@ -32,8 +33,13 @@ import org.apache.pdfbox.contentstream.o
 public class SetMatrix extends OperatorProcessor
 {
     @Override
-    public void process(Operator operator, List<COSBase> arguments)
+    public void process(Operator operator, List<COSBase> arguments) throws MissingOperandException
     {
+        if (arguments.size() < 6)
+        {
+            throw new MissingOperandException(operator, arguments);
+        }
+        
         COSNumber a = (COSNumber)arguments.get( 0 );
         COSNumber b = (COSNumber)arguments.get( 1 );
         COSNumber c = (COSNumber)arguments.get( 2 );

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/MoveText.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/MoveText.java?rev=1674143&r1=1674142&r2=1674143&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/MoveText.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/MoveText.java
Thu Apr 16 20:03:32 2015
@@ -18,11 +18,12 @@ package org.apache.pdfbox.contentstream.
 
 import java.util.List;
 
+import org.apache.pdfbox.contentstream.operator.MissingOperandException;
+import org.apache.pdfbox.contentstream.operator.Operator;
+import org.apache.pdfbox.contentstream.operator.OperatorProcessor;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSNumber;
 import org.apache.pdfbox.util.Matrix;
-import org.apache.pdfbox.contentstream.operator.Operator;
-import org.apache.pdfbox.contentstream.operator.OperatorProcessor;
 
 /**
  * Td: Move text position.
@@ -32,8 +33,13 @@ import org.apache.pdfbox.contentstream.o
 public class MoveText extends OperatorProcessor
 {
     @Override
-    public void process(Operator operator, List<COSBase> arguments)
+    public void process(Operator operator, List<COSBase> arguments) throws MissingOperandException
     {
+        if (arguments.size() < 2)
+        {
+            throw new MissingOperandException(operator, arguments);
+        }
+        
         COSNumber x = (COSNumber)arguments.get( 0 );
         COSNumber y = (COSNumber)arguments.get( 1 );
 

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/MoveTextSetLeading.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/MoveTextSetLeading.java?rev=1674143&r1=1674142&r2=1674143&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/MoveTextSetLeading.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/MoveTextSetLeading.java
Thu Apr 16 20:03:32 2015
@@ -19,6 +19,7 @@ package org.apache.pdfbox.contentstream.
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.pdfbox.contentstream.operator.MissingOperandException;
 
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSFloat;
@@ -36,6 +37,11 @@ public class MoveTextSetLeading extends
     @Override
     public void process(Operator operator, List<COSBase> arguments) throws IOException
     {
+        if (arguments.size() < 2)
+        {
+            throw new MissingOperandException(operator, arguments);
+        }
+        
         //move text position and set leading
         COSNumber y = (COSNumber)arguments.get(1);
 

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetTextHorizontalScaling.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetTextHorizontalScaling.java?rev=1674143&r1=1674142&r2=1674143&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetTextHorizontalScaling.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetTextHorizontalScaling.java
Thu Apr 16 20:03:32 2015
@@ -16,14 +16,14 @@
  */
 package org.apache.pdfbox.contentstream.operator.text;
 
+import java.io.IOException;
 import java.util.List;
 
-import org.apache.pdfbox.cos.COSBase;
-import org.apache.pdfbox.cos.COSNumber;
+import org.apache.pdfbox.contentstream.operator.MissingOperandException;
 import org.apache.pdfbox.contentstream.operator.Operator;
 import org.apache.pdfbox.contentstream.operator.OperatorProcessor;
-
-import java.io.IOException;
+import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.cos.COSNumber;
 
 /**
  * Tz: Set horizontal text scaling.
@@ -35,6 +35,11 @@ public class SetTextHorizontalScaling ex
     @Override
     public void process(Operator operator, List<COSBase> arguments) throws IOException
     {
+        if (arguments.size() < 1)
+        {
+            throw new MissingOperandException(operator, arguments);
+        }
+        
         COSNumber scaling = (COSNumber)arguments.get(0);
         context.getGraphicsState().getTextState().setHorizontalScaling(scaling.floatValue());
     }



Mime
View raw message