[poppler] poppler/SecurityHandler.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 28 23:36:08 UTC 2021


 poppler/SecurityHandler.cc |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit dc587846bff99b07dc351d2d21e5b6908c99afdb
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat May 29 01:31:02 2021 +0200

    pad ownerKey/userKey if < 32
    
    Inspired by xpdf

diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc
index e5ec1007..a746f5a4 100644
--- a/poppler/SecurityHandler.cc
+++ b/poppler/SecurityHandler.cc
@@ -251,6 +251,17 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA, Object *encryptDi
     } else {
         error(errSyntaxError, -1, "Weird encryption info");
     }
+
+    if (encRevision <= 4) {
+        // Adobe apparently zero-pads the U value (and maybe the O value?)
+        // if it's short
+        while (ownerKey->getLength() < 32) {
+            ownerKey->append((char)0x00);
+        }
+        while (userKey->getLength() < 32) {
+            userKey->append((char)0x00);
+        }
+    }
 }
 
 StandardSecurityHandler::~StandardSecurityHandler()


More information about the poppler mailing list