lua

A copy of the Lua development repository
Log | Files | Refs | README

commit a3f9c1a77abb2add30334160055dc2ed11eb0b2e
parent 6dbae1b5d961a76d1e2ffd5d50d20b86290f483c
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue, 25 Apr 2017 17:00:47 -0300

detail (using unsigned comparison in range check for LOADI)

Diffstat:
Mlcode.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lcode.c b/lcode.c @@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 2.114 2017/04/24 20:26:39 roberto Exp roberto $ +** $Id: lcode.c,v 2.115 2017/04/25 18:28:25 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -516,7 +516,7 @@ static int nilK (FuncState *fs) { void luaK_int (FuncState *fs, int reg, lua_Integer i) { - if (-MAXARG_sBx <= i && i <= MAXARG_sBx) + if (l_castS2U(i) + MAXARG_sBx <= l_castS2U(MAXARG_Bx)) luaK_codeAsBx(fs, OP_LOADI, reg, cast_int(i)); else luaK_codek(fs, reg, luaK_intK(fs, i));