aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-04-14 13:59:46 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-04-14 13:59:46 -0300
commita2c094fe2d78ccbe900cddbd7df783d9115192a6 (patch)
tree63207a9cb5fb8fc964016b84d6dc6f249f2de7a5
parentf767f29d87d847d6a8d82a696d09569489e12642 (diff)
downloadlua-a2c094fe2d78ccbe900cddbd7df783d9115192a6.tar.gz
lua-a2c094fe2d78ccbe900cddbd7df783d9115192a6.tar.bz2
lua-a2c094fe2d78ccbe900cddbd7df783d9115192a6.zip
size of strings in 'string.rep' should be limited by the size of
lua_Integer, not of 'int'
-rw-r--r--lstrlib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lstrlib.c b/lstrlib.c
index 3e89981d..6cd07ebd 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.194 2014/04/10 19:45:43 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.195 2014/04/12 14:45:10 roberto Exp roberto $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -104,8 +104,8 @@ static int str_upper (lua_State *L) {
104 104
105 105
106/* reasonable limit to avoid arithmetic overflow and strings too big */ 106/* reasonable limit to avoid arithmetic overflow and strings too big */
107#if INT_MAX / 2 <= 0x10000000 107#if LUA_MAXINTEGER / 2 <= 0x10000000
108#define MAXSIZE ((size_t)(INT_MAX / 2)) 108#define MAXSIZE ((size_t)(LUA_MAXINTEGER / 2))
109#else 109#else
110#define MAXSIZE ((size_t)0x10000000) 110#define MAXSIZE ((size_t)0x10000000)
111#endif 111#endif