Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Unified Diff: fpdfsdk/fpdfview.cpp

Issue 2005653002: Distinguish between user and owner passwords. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_parser/include/cpdf_parser.h ('k') | pdfium.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfview.cpp
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 020ff8df6d57c8bc39d52c914b7d1754013b0cca..e7b3a96b0b3cbcaa38a39da74b1c3317b107c13f 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) {
« no previous file with comments | « core/fpdfapi/fpdf_parser/include/cpdf_parser.h ('k') | pdfium.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698