From dc4232379d79bc4ff5ad16bebf41793bb7ba6deb Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 2 Oct 2015 12:39:23 -0300 Subject: detail (ensure subtraction is done unsigned) --- lmathlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lmathlib.c') diff --git a/lmathlib.c b/lmathlib.c index 4cfe33e8..8c9627c2 100644 --- a/lmathlib.c +++ b/lmathlib.c @@ -1,5 +1,5 @@ /* -** $Id: lmathlib.c,v 1.115 2015/03/12 14:04:04 roberto Exp roberto $ +** $Id: lmathlib.c,v 1.116 2015/06/26 19:30:32 roberto Exp $ ** Standard mathematical library ** See Copyright Notice in lua.h */ @@ -39,7 +39,7 @@ static int math_abs (lua_State *L) { if (lua_isinteger(L, 1)) { lua_Integer n = lua_tointeger(L, 1); - if (n < 0) n = (lua_Integer)(0u - n); + if (n < 0) n = (lua_Integer)(0u - (lua_Unsigned)n); lua_pushinteger(L, n); } else -- cgit v1.2.3-55-g6feb