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

Unified Diff: xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp

Issue 1472383003: Fix a crasher caused by an invalid index in CXFA_LayoutPageMgr::GetPage() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
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 262a0be7171040c768bb8b2f39c22bcea4124846..f83b7720035ddda25e136e702562bcd09d55eae6 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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698