diff options
author | Albert Astals Cid <aacid@kde.org> | 2015-03-07 14:54:43 +0100 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2015-03-07 14:54:43 +0100 |
commit | c909964bff671d5ff0d8eee5f613ded4562f8afd (patch) | |
tree | 6adf33de36963b5aa39f722ff893f4367253c7fb | |
parent | 3705fcee0309c50b5fecd563e8e466cbe2c5972b (diff) |
Do not assert on broken document
Bug #89422
-rw-r--r-- | poppler/SecurityHandler.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc index d6f55995..44bd8b8d 100644 --- a/poppler/SecurityHandler.cc +++ b/poppler/SecurityHandler.cc @@ -288,12 +288,16 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA, ok = gTrue; } else if (encVersion == 5 && encRevision == 5) { fileID = new GooString(); // unused for V=R=5 - ownerEnc = ownerEncObj.getString()->copy(); - userEnc = userEncObj.getString()->copy(); - if (fileKeyLength > 32 || fileKeyLength < 0) { - fileKeyLength = 32; + if (ownerEncObj.isString() && userEncObj.isString()) { + ownerEnc = ownerEncObj.getString()->copy(); + userEnc = userEncObj.getString()->copy(); + if (fileKeyLength > 32 || fileKeyLength < 0) { + fileKeyLength = 32; + } + ok = gTrue; + } else { + error(errSyntaxError, -1, "Weird encryption owner/user info"); } - ok = gTrue; } else if (!(encVersion == -1 && encRevision == -1)) { error(errUnimplemented, -1, "Unsupported version/revision ({0:d}/{1:d}) of Standard security handler", |