pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1704417 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetTextRise.java
Date Mon, 21 Sep 2015 20:28:21 GMT
Author: tilman
Date: Mon Sep 21 20:28:21 2015
New Revision: 1704417

URL: http://svn.apache.org/viewvc?rev=1704417&view=rev
Log:
PDFBOX-2982: avoid ArrayOutOfBoundsException and ClassCastException

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetTextRise.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetTextRise.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetTextRise.java?rev=1704417&r1=1704416&r2=1704417&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetTextRise.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetTextRise.java
Mon Sep 21 20:28:21 2015
@@ -24,6 +24,7 @@ import org.apache.pdfbox.contentstream.o
 import org.apache.pdfbox.contentstream.operator.OperatorProcessor;
 
 import java.io.IOException;
+import org.apache.pdfbox.cos.COSArray;
 
 /**
  * Ts: Set text rise.
@@ -35,7 +36,16 @@ public class SetTextRise extends Operato
     @Override
     public void process(Operator operator, List<COSBase> arguments) throws IOException
     {
-        COSNumber rise = (COSNumber)arguments.get(0);
+        if (arguments.size() < 1)
+        {
+            return;
+        }
+        COSBase base = arguments.get(0);
+        if (!(base instanceof COSNumber))
+        {
+            return;
+        }
+        COSNumber rise = (COSNumber) base;
         context.getGraphicsState().getTextState().setRise( rise.floatValue() );
     }
 



Mime
View raw message