You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by pd...@apache.org on 2020/02/28 18:36:34 UTC

[openwhisk-wskdeploy] branch master updated: Fix max int. comparison for 386 archs (#1090)

This is an automated email from the ASF dual-hosted git repository.

pdesai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdeploy.git


The following commit(s) were added to refs/heads/master by this push:
     new 33ba29b  Fix max int. comparison for 386 archs (#1090)
33ba29b is described below

commit 33ba29b278bc5f7693303b3cb4b89a568321e668
Author: Matt Rutkowski <mr...@us.ibm.com>
AuthorDate: Fri Feb 28 12:36:26 2020 -0600

    Fix max int. comparison for 386 archs (#1090)
---
 webaction/webaction.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/webaction/webaction.go b/webaction/webaction.go
index e69c073..b4f2f9f 100644
--- a/webaction/webaction.go
+++ b/webaction/webaction.go
@@ -213,7 +213,10 @@ func ValidateRequireWhiskAuthAnnotationValue(actionName string, value interface{
 			// However, in JS, the bitwise operators and shift operators operate on 32-bit ints,
 			// so in that case, the max safe integer is 231-1, or 2147483647
 			// We also disallow negative integers
-			if secureValue < MAX_JS_INT && secureValue > 0 {
+			// NOTE: when building for 386 archs. we need to assure comparison with MAX_JS_INT does not
+			// "blow up" and must allow the compiler to compare an untyped int (secureValue) to effectively
+			// an int64... so for the comparison we MUST force a type conversion to avoid "int" size mismatch
+			if int64(secureValue) < MAX_JS_INT && secureValue > 0 {
 				isValid = true
 				enabled = wski18n.FEATURE_ENABLED
 			}