lua

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

commit 5a568a3b01d4a816d6cb15a0c48ca6096c837ef1
parent 475e6c5352c3daecdd54fe2346b3c3b07f17a791
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue, 25 Oct 2011 10:00:56 -0200

detail (comment)

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

diff --git a/lstrlib.c b/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.170 2011/06/28 17:13:52 roberto Exp roberto $ +** $Id: lstrlib.c,v 1.171 2011/08/09 20:58:29 roberto Exp roberto $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -138,7 +138,7 @@ static int str_byte (lua_State *L) { if (pose > l) pose = l; if (posi > pose) return 0; /* empty interval; return no values */ n = (int)(pose - posi + 1); - if (posi + n <= pose) /* overflow? */ + if (posi + n <= pose) /* (size_t -> int) overflow? */ return luaL_error(L, "string slice too long"); luaL_checkstack(L, n, "string slice too long"); for (i=0; i<n; i++)