pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1783571 - in /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox: contentstream/operator/graphics/BeginInlineImage.java pdfparser/PDFStreamParser.java
Date Sat, 18 Feb 2017 16:46:54 GMT
Author: tilman
Date: Sat Feb 18 16:46:54 2017
New Revision: 1783571

URL: http://svn.apache.org/viewvc?rev=1783571&view=rev
Log:
PDFBOX-3694: warn and skip empty inline images

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/BeginInlineImage.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/BeginInlineImage.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/BeginInlineImage.java?rev=1783571&r1=1783570&r2=1783571&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/BeginInlineImage.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/BeginInlineImage.java
Sat Feb 18 16:46:54 2017
@@ -34,6 +34,10 @@ public final class BeginInlineImage exte
     @Override
     public void process(Operator operator, List<COSBase> operands) throws IOException
     {
+        if (operator.getImageData().length == 0)
+        {
+            return;
+        }
         PDImage image = new PDInlineImage(operator.getImageParameters(),
                                           operator.getImageData(),
                                           context.getResources());

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java?rev=1783571&r1=1783570&r2=1783571&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
Sat Feb 18 16:46:54 2017
@@ -286,6 +286,10 @@ public class PDFStreamParser extends Bas
                     }
                     //final token will be the image data, maybe??
                     Operator imageData = (Operator)nextToken;
+                    if (imageData.getImageData().length == 0)
+                    {
+                        LOG.warn("empty inline image at stream offset " + seqSource.getPosition());
+                    }
                     beginImageOP.setImageData( imageData.getImageData() );
                 }
                 break;



Mime
View raw message