Skip to content

Commit

Permalink
Fix max int. comparison for 386 archs (#1090)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrutkows authored Feb 28, 2020
1 parent eeae4b6 commit 33ba29b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion webaction/webaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 33ba29b

Please sign in to comment.