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

Unified Diff: xfa/fxfa/fm2js/xfa_simpleexpression.cpp

Issue 2206253002: Fix FMCallExpression undefined shift behaviour. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Review cleanup Created 4 years, 4 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 | « pdfium.gyp ('k') | xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/fm2js/xfa_simpleexpression.cpp
diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
index 47bb9df235583b0fcb51c34e0ba5a32762d2379e..a7a88ec30aa70d0d22d68c6a7470a7c7e5946a16 100644
--- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
+++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
@@ -541,7 +541,10 @@ void CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
uint32_t methodPara = IsMethodWithObjParam(funcName.AsStringC());
if (methodPara > 0) {
for (int i = 0; i < m_pArguments->GetSize(); ++i) {
- if ((methodPara & (0x01 << i)) > 0) {
+ // Currently none of our expressions use objects for a parameter over
+ // the 6th. Make sure we don't overflow the shift when doing this
+ // check. If we ever need more the 32 object params we can revisit.
+ if (i < 32 && (methodPara & (0x01 << i)) > 0) {
javascript << gs_lpStrExpFuncName[GETFMJSOBJ];
} else {
javascript << gs_lpStrExpFuncName[GETFMVALUE];
« no previous file with comments | « pdfium.gyp ('k') | xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698