From a2c094fe2d78ccbe900cddbd7df783d9115192a6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 14 Apr 2014 13:59:46 -0300 Subject: size of strings in 'string.rep' should be limited by the size of lua_Integer, not of 'int' --- lstrlib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lstrlib.c') diff --git a/lstrlib.c b/lstrlib.c index 3e89981d..6cd07ebd 100644 --- a/lstrlib.c +++ b/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.194 2014/04/10 19:45:43 roberto Exp roberto $ +** $Id: lstrlib.c,v 1.195 2014/04/12 14:45:10 roberto Exp roberto $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -104,8 +104,8 @@ static int str_upper (lua_State *L) { /* reasonable limit to avoid arithmetic overflow and strings too big */ -#if INT_MAX / 2 <= 0x10000000 -#define MAXSIZE ((size_t)(INT_MAX / 2)) +#if LUA_MAXINTEGER / 2 <= 0x10000000 +#define MAXSIZE ((size_t)(LUA_MAXINTEGER / 2)) #else #define MAXSIZE ((size_t)0x10000000) #endif -- cgit v1.2.3-55-g6feb