diff options
author | thestig <thestig@chromium.org> | 2016-04-06 12:12:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-06 12:12:52 -0700 |
commit | b8db5115e37898a2e399714db062707e8cc0a021 (patch) | |
tree | e0bb933b7dbe29fe14525f399a546ea93389e9b6 /fpdfsdk/fpdfview.cpp | |
parent | e530fb7976922c4934812f8721e7550ced17786b (diff) | |
download | pdfium-b8db5115e37898a2e399714db062707e8cc0a021.tar.xz |
FPDF_GetSecurityHandlerRevision() should not crash.
Same for FPDF_GetDocPermissions().
Empty documents do not have parsers.
BUG=pdfium:465
Review URL: https://codereview.chromium.org/1865523003
Diffstat (limited to 'fpdfsdk/fpdfview.cpp')
-rw-r--r-- | fpdfsdk/fpdfview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index df7518902f..3f02feeadf 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -463,7 +463,7 @@ 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) + if (!pDoc || !pDoc->GetParser()) #ifndef PDF_ENABLE_XFA return 0; #else // PDF_ENABLE_XFA @@ -476,7 +476,7 @@ DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document) { DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) { CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); - if (!pDoc) + if (!pDoc || !pDoc->GetParser()) return -1; CPDF_Dictionary* pDict = pDoc->GetParser()->GetEncryptDict(); |