pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1850407 - /pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/StandardColorSpaceHelper.java
Date Fri, 04 Jan 2019 17:15:43 GMT
Author: tilman
Date: Fri Jan  4 17:15:43 2019
New Revision: 1850407

URL: http://svn.apache.org/viewvc?rev=1850407&view=rev
Log:
PDFBOX-4071: avoid memory leak and add comment what is being done and why

Modified:
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/StandardColorSpaceHelper.java

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/StandardColorSpaceHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/StandardColorSpaceHelper.java?rev=1850407&r1=1850406&r2=1850407&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/StandardColorSpaceHelper.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/StandardColorSpaceHelper.java
Fri Jan  4 17:15:43 2019
@@ -23,6 +23,7 @@ package org.apache.pdfbox.preflight.grap
 
 import java.awt.color.ICC_Profile;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.Map;
 
 import org.apache.pdfbox.cos.COSArray;
@@ -235,7 +236,12 @@ public class StandardColorSpaceHelper im
         PDICCBased iccBased = (PDICCBased) colorSpace;
         try
         {
-            ICC_Profile.getInstance(iccBased.getPDStream().createInputStream());
+            try (InputStream is = iccBased.getPDStream().createInputStream())
+            {
+                // check that ICC profile loads (PDICCBased also does this, but catches the
exception)
+                // PDFBOX-2819: load ICC profile as a stream, not as a byte array because
of java error
+                ICC_Profile.getInstance(is);
+            }
             PDColorSpace altpdcs = iccBased.getAlternateColorSpace();
             if (altpdcs != null)
             {



Mime
View raw message