summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2016-02-02 17:19:57 -0800
committerJun Fang <jun_fang@foxitsoftware.com>2016-02-02 17:19:57 -0800
commit8878029366d3815489384c5cee344e66b6e9f805 (patch)
treebdcd498ef393ed4215ab020ba7bc17a861f96d3f /fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
parented5d7aa789ec5ef7b440d7e56b71804b41a928e3 (diff)
downloadpdfium-8878029366d3815489384c5cee344e66b6e9f805.tar.xz
XFA: Fix SEGV in CPDFXFA_Document::SetCurrentPage()
BUG=pdfium:377 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1658163002 .
Diffstat (limited to 'fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp')
-rw-r--r--fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
index d37038d2af..df8b839bb1 100644
--- a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
@@ -542,15 +542,13 @@ int32_t CPDFXFA_Document::GetCurrentPage(IXFA_Doc* hDoc) {
return pEnv->FFI_GetCurrentPageIndex(this);
}
void CPDFXFA_Document::SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage) {
- if (hDoc != m_pXFADoc || !m_pSDKDoc)
- return;
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
+ if (hDoc != m_pXFADoc || !m_pSDKDoc || m_iDocType != DOCTYPE_DYNAMIC_XFA ||
+ iCurPage < 0 || iCurPage >= m_pSDKDoc->GetPageCount()) {
return;
-
+ }
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
- if (pEnv == NULL)
+ if (!pEnv)
return;
-
pEnv->FFI_SetCurrentPage(this, iCurPage);
}
FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(IXFA_Doc* hDoc) {