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

Unified Diff: xfa/src/fxfa/src/fm2js/xfa_lexer.cpp

Issue 1718453003: Add a proper bounds check to XFA_FM_KeywordToString (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/src/fxfa/src/fm2js/xfa_lexer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/src/fxfa/src/fm2js/xfa_lexer.cpp
diff --git a/xfa/src/fxfa/src/fm2js/xfa_lexer.cpp b/xfa/src/fxfa/src/fm2js/xfa_lexer.cpp
index 957c21b87418d0c5ddf895aaeab596bba7128084..2902f8c70b97785212cf26e5707f9e5a74453e78 100644
--- a/xfa/src/fxfa/src/fm2js/xfa_lexer.cpp
+++ b/xfa/src/fxfa/src/fm2js/xfa_lexer.cpp
@@ -83,7 +83,7 @@ inline FX_BOOL XFA_FMDChar::isUnicodeAlpha(uint16_t ch) {
return TRUE;
}
-XFA_FMKeyword keyWords[] = {
+const XFA_FMKeyword keyWords[] = {
{TOKand, 0x00000026, L"&"},
{TOKlparen, 0x00000028, L"("},
{TOKrparen, 0x00000029, L")"},
@@ -145,13 +145,15 @@ XFA_FMKeyword keyWords[] = {
{TOKendif, 0xe0e8fee6, L"endif"},
};
-const FX_WORD KEYWORD_START = TOKdo;
-const FX_WORD KEYWORD_END = TOKendif;
+const XFA_FM_TOKEN KEYWORD_START = TOKdo;
+const XFA_FM_TOKEN KEYWORD_END = TOKendif;
} // namespace
const FX_WCHAR* XFA_FM_KeywordToString(XFA_FM_TOKEN op) {
- return keyWords[op].m_keword;
+ if (op < KEYWORD_START || op > KEYWORD_END)
Tom Sepez 2016/02/19 23:09:45 TOKdo isn't the first enum value, are you sure you
Oliver Chang 2016/02/19 23:12:57 I assume this is the intention of this function, s
Tom Sepez 2016/02/19 23:17:51 Acknowledged.
+ return L"";
+ return keyWords[op].m_keyword;
}
CXFA_FMToken::CXFA_FMToken() : m_type(TOKreserver), m_uLinenum(1) {}
« no previous file with comments | « xfa/src/fxfa/src/fm2js/xfa_lexer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698