[poppler] poppler/SecurityHandler.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 27 21:38:24 UTC 2021


 poppler/SecurityHandler.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9293e4bf9f6fa6513ddd51fe3426c39b54b1a49d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu May 27 23:30:46 2021 +0200

    Don't force ownerKey and userKey to be exacly 32 chars long
    
    The spec says that they have to be this long, but then when calculating
    the hashes says "if it is longer, cut it, if it is shorter, add these
    characters" (and we implement that) so it's a bit of spec mismatch.
    
    Fixes issue #1083

diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc
index 39f1131a..e5ec1007 100644
--- a/poppler/SecurityHandler.cc
+++ b/poppler/SecurityHandler.cc
@@ -144,7 +144,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA, Object *encryptDi
     if (versionObj.isInt() && revisionObj.isInt() && permObj.isInt() && ownerKeyObj.isString() && userKeyObj.isString()) {
         encVersion = versionObj.getInt();
         encRevision = revisionObj.getInt();
-        if ((encRevision <= 4 && ownerKeyObj.getString()->getLength() == 32 && userKeyObj.getString()->getLength() == 32)
+        if ((encRevision <= 4 && ownerKeyObj.getString()->getLength() >= 1 && userKeyObj.getString()->getLength() >= 1)
             || ((encRevision == 5 || encRevision == 6) &&
                 // the spec says 48 bytes, but Acrobat pads them out longer
                 ownerKeyObj.getString()->getLength() >= 48 && userKeyObj.getString()->getLength() >= 48 && ownerEncObj.isString() && ownerEncObj.getString()->getLength() == 32 && userEncObj.isString()


More information about the poppler mailing list