summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfview.cpp
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-05-23 15:06:59 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-23 15:06:59 -0700
commit27ddf161579f79510b361d0016ccc7f0cdffdc6d (patch)
treebc5a13661d288faeccc8471275059a9d5e8795bc /fpdfsdk/fpdfview.cpp
parent490d6128e6faef423fa6f965f792513e138bc04a (diff)
downloadpdfium-27ddf161579f79510b361d0016ccc7f0cdffdc6d.tar.xz
Distinguish between user and owner passwords.
BUG=pdfium:496 Review-Url: https://codereview.chromium.org/2005653002
Diffstat (limited to 'fpdfsdk/fpdfview.cpp')
-rw-r--r--fpdfsdk/fpdfview.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 020ff8df6d..e7b3a96b0b 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -464,15 +464,16 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc,
// header).
DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc || !pDoc->GetParser())
+ // https://bugs.chromium.org/p/pdfium/issues/detail?id=499
+ if (!pDoc) {
#ifndef PDF_ENABLE_XFA
return 0;
#else // PDF_ENABLE_XFA
- return (uint32_t)-1;
+ return 0xFFFFFFFF;
#endif // PDF_ENABLE_XFA
+ }
- CPDF_Dictionary* pDict = pDoc->GetParser()->GetEncryptDict();
- return pDict ? pDict->GetIntegerBy("P") : (uint32_t)-1;
+ return pDoc->GetUserPermissions();
}
DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) {