75a61b
From c909964bff671d5ff0d8eee5f613ded4562f8afd Mon Sep 17 00:00:00 2001
75a61b
From: Albert Astals Cid <aacid@kde.org>
75a61b
Date: Sat, 7 Mar 2015 14:54:43 +0100
75a61b
Subject: Do not assert on broken document
75a61b
75a61b
Bug #89422
75a61b
75a61b
diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc
75a61b
index d6f5599..44bd8b8 100644
75a61b
--- a/poppler/SecurityHandler.cc
75a61b
+++ b/poppler/SecurityHandler.cc
75a61b
@@ -288,12 +288,16 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA,
75a61b
 	ok = gTrue;
75a61b
       } else if (encVersion == 5 && encRevision == 5) {
75a61b
 	fileID = new GooString(); // unused for V=R=5
75a61b
-	ownerEnc = ownerEncObj.getString()->copy();
75a61b
-	userEnc = userEncObj.getString()->copy();
75a61b
-	if (fileKeyLength > 32 || fileKeyLength < 0) {
75a61b
-	  fileKeyLength = 32;
75a61b
+	if (ownerEncObj.isString() && userEncObj.isString()) {
75a61b
+	  ownerEnc = ownerEncObj.getString()->copy();
75a61b
+	  userEnc = userEncObj.getString()->copy();
75a61b
+	  if (fileKeyLength > 32 || fileKeyLength < 0) {
75a61b
+	    fileKeyLength = 32;
75a61b
+	  }
75a61b
+	  ok = gTrue;
75a61b
+	} else {
75a61b
+	  error(errSyntaxError, -1, "Weird encryption owner/user info");
75a61b
 	}
75a61b
-	ok = gTrue;
75a61b
       } else if (!(encVersion == -1 && encRevision == -1)) {
75a61b
 	error(errUnimplemented, -1,
75a61b
 	      "Unsupported version/revision ({0:d}/{1:d}) of Standard security handler",
75a61b
-- 
75a61b
cgit v0.10.2
75a61b