aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
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 /lvm.c
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 'lvm.c')
-rw-r--r--lvm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lvm.c b/lvm.c
index ec83f415..c84a665f 100644
--- a/lvm.c
+++ b/lvm.c
@@ -766,7 +766,7 @@ lua_Number luaV_modf (lua_State *L, lua_Number m, lua_Number n) {
766/* 766/*
767** Shift left operation. (Shift right just negates 'y'.) 767** Shift left operation. (Shift right just negates 'y'.)
768*/ 768*/
769#define luaV_shiftr(x,y) luaV_shiftl(x,-(y)) 769#define luaV_shiftr(x,y) luaV_shiftl(x,intop(-, 0, y))
770 770
771lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) { 771lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) {
772 if (y < 0) { /* shift right? */ 772 if (y < 0) { /* shift right? */