poppler/SecurityHandler.cc | 11 +++++++++++ 1 file changed, 11 insertions(+)
New commits: commit dc587846bff99b07dc351d2d21e5b6908c99afdb Author: Albert Astals Cid <[email protected]> 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() _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
