From 33ba29b278bc5f7693303b3cb4b89a568321e668 Mon Sep 17 00:00:00 2001 From: Matt Rutkowski Date: Fri, 28 Feb 2020 12:36:26 -0600 Subject: [PATCH] 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 e69c07350..b4f2f9ff4 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 }