pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1854566 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
Date Fri, 01 Mar 2019 08:51:38 GMT
Author: tilman
Date: Fri Mar  1 08:51:38 2019
New Revision: 1854566

URL: http://svn.apache.org/viewvc?rev=1854566&view=rev
Log:
PDFBOX-4477: don't insert types into set that don't get decrypted

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java?rev=1854566&r1=1854565&r2=1854566&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
Fri Mar  1 08:51:38 2019
@@ -394,26 +394,30 @@ public abstract class SecurityHandler
      */
     public void decrypt(COSBase obj, long objNum, long genNum) throws IOException
     {
-        if (!objects.contains(obj))
+        if (!(obj instanceof COSString || obj instanceof COSDictionary || obj instanceof
COSArray))
         {
-            objects.add(obj);
-
-            if (obj instanceof COSString)
-            {
-                decryptString((COSString) obj, objNum, genNum);
-            }
-            else if (obj instanceof COSStream)
-            {
-                decryptStream((COSStream) obj, objNum, genNum);
-            }
-            else if (obj instanceof COSDictionary)
-            {
-                decryptDictionary((COSDictionary) obj, objNum, genNum);
-            }
-            else if (obj instanceof COSArray)
-            {
-                decryptArray((COSArray) obj, objNum, genNum);
-            }
+            return;
+        }
+        if (objects.contains(obj))
+        {
+            return;
+        }
+        objects.add(obj);
+        if (obj instanceof COSString)
+        {
+            decryptString((COSString) obj, objNum, genNum);
+        }
+        else if (obj instanceof COSStream)
+        {
+            decryptStream((COSStream) obj, objNum, genNum);
+        }
+        else if (obj instanceof COSDictionary)
+        {
+            decryptDictionary((COSDictionary) obj, objNum, genNum);
+        }
+        else if (obj instanceof COSArray)
+        {
+            decryptArray((COSArray) obj, objNum, genNum);
         }
     }
 



Mime
View raw message