summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-11-27 14:39:03 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-11-27 14:39:03 +0800
commit1bf1024d43293dacdd7ee5490c46b650b3bbd1d2 (patch)
treef50ed690517ee0d7dffe27e74c997fae1dd1ee99 /xfa
parent51da093564cdfd32a6ac02ad75e981787a0f1b35 (diff)
downloadpdfium-1bf1024d43293dacdd7ee5490c46b650b3bbd1d2.tar.xz
Fix a crasher caused by an invalid index in CXFA_LayoutPageMgr::GetPage()
BUG=pdfium:289 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1472383003 .
Diffstat (limited to 'xfa')
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
index 262a0be717..f83b772003 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
@@ -603,10 +603,9 @@ int32_t CXFA_LayoutPageMgr::GetPageCount() const {
return m_PageArray.GetSize();
}
IXFA_LayoutPage* CXFA_LayoutPageMgr::GetPage(int32_t index) const {
- if (m_PageArray.GetSize() > index) {
- return m_PageArray[index];
- }
- return NULL;
+ if (index < 0 || index >= m_PageArray.GetSize())
+ return nullptr;
+ return m_PageArray[index];
}
int32_t CXFA_LayoutPageMgr::GetPageIndex(const IXFA_LayoutPage* pPage) const {
// FIXME: Find() method should take const.