[poppler] [PATCHv2 2/4] Added cases and conditions for V=5 R=6 document in StandardSecurityHandler constructor.

Alok Anand alok4nand at gmail.com
Thu Mar 10 18:34:18 UTC 2016


---
 poppler/SecurityHandler.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
 mode change 100644 => 100755 poppler/SecurityHandler.cc

diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc
old mode 100644
new mode 100755
index 63d8b4e..3e56f7d
--- a/poppler/SecurityHandler.cc
+++ b/poppler/SecurityHandler.cc
@@ -186,7 +186,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA,
     if ((encRevision <= 4 &&
 	 ownerKeyObj.getString()->getLength() == 32 &&
 	 userKeyObj.getString()->getLength() == 32) ||
-	(encRevision == 5 &&
+	 ((encRevision == 5 || encRevision == 6) &&
 	 // the spec says 48 bytes, but Acrobat pads them out longer
 	 ownerKeyObj.getString()->getLength() >= 48 &&
 	 userKeyObj.getString()->getLength() >= 48 &&
@@ -208,7 +208,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA,
       //~ doesn't handle the case where StmF, StrF, and EFF are not all the
       //~ same)
       if ((encVersion == 4 || encVersion == 5) &&
-	  (encRevision == 4 || encRevision == 5)) {
+	  (encRevision == 4 || encRevision == 5 || encRevision == 6)) {
 	encryptDictA->dictLookup("CF", &cryptFiltersObj);
 	encryptDictA->dictLookup("StmF", &streamFilterObj);
 	encryptDictA->dictLookup("StrF", &stringFilterObj);
@@ -244,7 +244,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA,
 		cfLengthObj.free();
 	      } else if (cfmObj.isName("AESV3")) {
 		encVersion = 5;
-		encRevision = 5;
+		//let encRevision be 5 or 6
 		encAlgorithm = cryptAES256;
 		if (cryptFilterObj.dictLookup("Length",
 					      &cfLengthObj)->isInt()) {
@@ -286,7 +286,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA,
 	  fileKeyLength = 16;
 	}
 	ok = gTrue;
-      } else if (encVersion == 5 && encRevision == 5) {
+} else if (encVersion == 5 && (encRevision == 5 || encRevision == 6)) {
 	fileID = new GooString(); // unused for V=R=5
 	if (ownerEncObj.isString() && userEncObj.isString()) {
 	  ownerEnc = ownerEncObj.getString()->copy();
-- 
2.7.2



More information about the poppler mailing list