summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-11-25 11:05:58 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-11-25 11:05:58 +0800
commit01fe5885b4dfbd9f116fb62b7bce585c153bfa77 (patch)
treef6f47f407cff5e3a107e613a5ecc95b15d375eb5
parent696d9faba208b0233cdfe0a43f3c6e5c90935843 (diff)
downloadpdfium-01fe5885b4dfbd9f116fb62b7bce585c153bfa77.tar.xz
Fix a issue that FFI_GetCurrentPageIndex always returns -1
The incorrect page index may cause a crasher in the following procedure. BUG=pdfium:285 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1466423004 .
-rw-r--r--fpdfsdk/include/fsdk_mgr.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h
index a3a97984df..3fc40ba085 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -220,15 +220,15 @@ class CPDFDoc_Environment final {
}
int FFI_GetCurrentPageIndex(FPDF_DOCUMENT document) {
- if (m_pInfo && m_pInfo->FFI_GetCurrentPageIndex)
- m_pInfo->FFI_GetCurrentPageIndex(m_pInfo, document);
- return -1;
+ if (!m_pInfo || !m_pInfo->FFI_GetCurrentPageIndex) {
+ return -1;
+ }
+ return m_pInfo->FFI_GetCurrentPageIndex(m_pInfo, document);
}
- int FFI_SetCurrentPage(FPDF_DOCUMENT document, int iCurPage) {
+ void FFI_SetCurrentPage(FPDF_DOCUMENT document, int iCurPage) {
if (m_pInfo && m_pInfo->FFI_SetCurrentPage)
m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage);
- return -1;
}
CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); }