summaryrefslogtreecommitdiff
path: root/xfa/src
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2016-02-23 08:32:22 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2016-02-23 08:32:22 +0800
commitbd7820c536908801e49ea83a6ca73279cc07f5cd (patch)
tree84f7788d34c0bbf629b1783248fda4e7a9102e58 /xfa/src
parent2484d42c1c55dae09ec5886db11006c6d0be75f1 (diff)
downloadpdfium-bd7820c536908801e49ea83a6ca73279cc07f5cd.tar.xz
Fix a crasher in ParsePostfixExpression()
BUG=pdfium:409 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1715363002 .
Diffstat (limited to 'xfa/src')
-rw-r--r--xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp b/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp
index c8eb962325..b451aa5487 100644
--- a/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp
+++ b/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp
@@ -567,7 +567,7 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression(
switch (m_pToken->m_type) {
case TOKlparen: {
NextToken();
- CFX_PtrArray* pArray = 0;
+ CFX_PtrArray* pArray = nullptr;
if (m_pToken->m_type != TOKrparen) {
pArray = new CFX_PtrArray();
while (m_pToken->m_type != TOKrparen) {
@@ -603,15 +603,13 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression(
e = 0;
}
} else {
- int32_t iSize = pArray->GetSize();
- for (int32_t i = 0; i < iSize; ++i) {
- CXFA_FMSimpleExpression* pTemp =
- (CXFA_FMSimpleExpression*)pArray->GetAt(i);
- delete pTemp;
+ int32_t nSize = pArray ? pArray->GetSize() : 0;
+ for (int32_t i = 0; i < nSize; ++i) {
+ delete static_cast<CXFA_FMSimpleExpression*>(pArray->GetAt(i));
}
delete pArray;
delete e;
- e = 0;
+ e = nullptr;
}
} break;
case TOKdot: