summaryrefslogtreecommitdiff
path: root/xfa/src/fxfa/src/fm2js/xfa_fmparse.h
diff options
context:
space:
mode:
authorOliver Chang <ochang@chromium.org>2016-02-17 16:51:56 -0800
committerOliver Chang <ochang@chromium.org>2016-02-17 16:51:56 -0800
commit1e1d3b0f2bc6b6c185b37e0aa6b8663e901dc8bf (patch)
tree56197c6d5664950ce17eb42224523e13b6b2c103 /xfa/src/fxfa/src/fm2js/xfa_fmparse.h
parent2398d8938277a2492b411f8f807bf1935918ccae (diff)
downloadpdfium-1e1d3b0f2bc6b6c185b37e0aa6b8663e901dc8bf.tar.xz
Fix some issues with CXFA_FMParse/CXFA_FMLexer infinite looping.chromium/2657chromium/2656chromium/2655
The parser did not expect an invalid token in some places, leading to an infinite loop. In the lexer, if an invalid string was found, the underlying pointer was never advanced. Also cleans some minor stuff along the way: - Remove nonsensical/useless destructors - Use unique_ptrs for owned members - Remove unused members - Other minor style changes BUG=587620 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1701363003 .
Diffstat (limited to 'xfa/src/fxfa/src/fm2js/xfa_fmparse.h')
-rw-r--r--xfa/src/fxfa/src/fm2js/xfa_fmparse.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/xfa/src/fxfa/src/fm2js/xfa_fmparse.h b/xfa/src/fxfa/src/fm2js/xfa_fmparse.h
index 45cd3db647..ed950c5aa4 100644
--- a/xfa/src/fxfa/src/fm2js/xfa_fmparse.h
+++ b/xfa/src/fxfa/src/fm2js/xfa_fmparse.h
@@ -6,10 +6,14 @@
#ifndef _XFA_FM_PARSE_H
#define _XFA_FM_PARSE_H
+
+#include <memory>
+
+#include "xfa/src/fxfa/src/fm2js/xfa_lexer.h"
+
class CXFA_FMParse {
public:
CXFA_FMParse();
- ~CXFA_FMParse();
int32_t Init(const CFX_WideStringC& wsFormcalc, CXFA_FMErrorInfo* pErrorInfo);
void NextToken();
void Check(XFA_FM_TOKEN op);
@@ -40,10 +44,9 @@ class CXFA_FMParse {
CXFA_FMSimpleExpression* ParseIndexExpression();
private:
- const FX_WCHAR* m_pScript;
- FX_STRSIZE m_uLength;
- CXFA_FMLexer* m_lexer;
+ std::unique_ptr<CXFA_FMLexer> m_lexer;
CXFA_FMToken* m_pToken;
CXFA_FMErrorInfo* m_pErrorInfo;
};
+
#endif