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

Side by Side Diff: fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp

Issue 1658163002: XFA: Fix SEGV in CPDFXFA_Document::SetCurrentPage() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/include/fsdk_define.h" 7 #include "fpdfsdk/include/fsdk_define.h"
8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" 8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
9 #include "fpdfsdk/include/fsdk_mgr.h" 9 #include "fpdfsdk/include/fsdk_mgr.h"
10 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" 10 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h"
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) 535 if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
536 return -1; 536 return -1;
537 537
538 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 538 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
539 if (pEnv == NULL) 539 if (pEnv == NULL)
540 return -1; 540 return -1;
541 541
542 return pEnv->FFI_GetCurrentPageIndex(this); 542 return pEnv->FFI_GetCurrentPageIndex(this);
543 } 543 }
544 void CPDFXFA_Document::SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage) { 544 void CPDFXFA_Document::SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage) {
545 if (hDoc != m_pXFADoc || !m_pSDKDoc) 545 if (hDoc != m_pXFADoc || !m_pSDKDoc || m_iDocType != DOCTYPE_DYNAMIC_XFA ||
546 iCurPage < 0 || iCurPage >= m_pSDKDoc->GetPageCount()) {
546 return; 547 return;
547 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) 548 }
549 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
550 if (!pEnv)
548 return; 551 return;
549
550 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
551 if (pEnv == NULL)
552 return;
553
554 pEnv->FFI_SetCurrentPage(this, iCurPage); 552 pEnv->FFI_SetCurrentPage(this, iCurPage);
555 } 553 }
556 FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(IXFA_Doc* hDoc) { 554 FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(IXFA_Doc* hDoc) {
557 if (hDoc != m_pXFADoc || !m_pSDKDoc) 555 if (hDoc != m_pXFADoc || !m_pSDKDoc)
558 return FALSE; 556 return FALSE;
559 if (m_pSDKDoc->GetInterForm()) 557 if (m_pSDKDoc->GetInterForm())
560 return m_pSDKDoc->GetInterForm()->IsXfaCalculateEnabled(); 558 return m_pSDKDoc->GetInterForm()->IsXfaCalculateEnabled();
561 559
562 return FALSE; 560 return FALSE;
563 } 561 }
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 } 1254 }
1257 1255
1258 return _GetHValueByName(szPropName, hValue, 1256 return _GetHValueByName(szPropName, hValue,
1259 m_pSDKDoc->GetEnv()->GetJSRuntime()); 1257 m_pSDKDoc->GetEnv()->GetJSRuntime());
1260 } 1258 }
1261 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, 1259 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name,
1262 FXJSE_HVALUE hValue, 1260 FXJSE_HVALUE hValue,
1263 IJS_Runtime* runTime) { 1261 IJS_Runtime* runTime) {
1264 return runTime->GetHValueByName(utf8Name, hValue); 1262 return runTime->GetHValueByName(utf8Name, hValue);
1265 } 1263 }
OLDNEW
« 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