aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-07-22 13:44:53 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-07-22 13:44:53 -0300
commit62fb93442753cbfb828335cd172e71471dffd536 (patch)
treea989f061765866aefb7b1ba4724163241edee922 /testes
parent8a32e0aa4afdfd575c329ce62baaf7a14888ed3b (diff)
downloadlua-62fb93442753cbfb828335cd172e71471dffd536.tar.gz
lua-62fb93442753cbfb828335cd172e71471dffd536.tar.bz2
lua-62fb93442753cbfb828335cd172e71471dffd536.zip
Bug: Negation in 'luaV_shiftr' may overflow
Negation of an unchecked lua_Integer overflows with mininteger.
Diffstat (limited to 'testes')
-rw-r--r--testes/bitwise.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/testes/bitwise.lua b/testes/bitwise.lua
index 59781f5d..9509f7f0 100644
--- a/testes/bitwise.lua
+++ b/testes/bitwise.lua
@@ -45,6 +45,11 @@ assert(-1 >> numbits == 0 and
45 -1 << numbits == 0 and 45 -1 << numbits == 0 and
46 -1 << -numbits == 0) 46 -1 << -numbits == 0)
47 47
48assert(1 >> math.mininteger == 0)
49assert(1 >> math.maxinteger == 0)
50assert(1 << math.mininteger == 0)
51assert(1 << math.maxinteger == 0)
52
48assert((2^30 - 1) << 2^30 == 0) 53assert((2^30 - 1) << 2^30 == 0)
49assert((2^30 - 1) >> 2^30 == 0) 54assert((2^30 - 1) >> 2^30 == 0)
50 55