Bug: Negation in 'luaV_shiftr' may overflow

Negation of an unchecked lua_Integer overflows with mininteger.
This commit is contained in:
Roberto Ierusalimschy
2021-07-22 13:44:53 -03:00
parent 8a32e0aa4a
commit 62fb934427
2 changed files with 6 additions and 1 deletions

View File

@@ -45,6 +45,11 @@ assert(-1 >> numbits == 0 and
-1 << numbits == 0 and
-1 << -numbits == 0)
assert(1 >> math.mininteger == 0)
assert(1 >> math.maxinteger == 0)
assert(1 << math.mininteger == 0)
assert(1 << math.maxinteger == 0)
assert((2^30 - 1) << 2^30 == 0)
assert((2^30 - 1) >> 2^30 == 0)