lua

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

commit fc24a3a6c40b573f1a89cf89b92d16a25519cc36
parent a94ce68e0aa9cd11dece30528d8dbd0354db1798
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 27 Apr 2012 11:12:55 -0300

small bug: a reader function should not modify the Lua stack

Diffstat:
Mlbaselib.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lbaselib.c b/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.272 2011/11/30 12:42:21 roberto Exp roberto $ +** $Id: lbaselib.c,v 1.273 2011/11/30 13:03:24 roberto Exp roberto $ ** Basic library ** See Copyright Notice in lua.h */ @@ -293,6 +293,7 @@ static const char *generic_reader (lua_State *L, void *ud, size_t *size) { lua_pushvalue(L, 1); /* get function */ lua_call(L, 0, 1); /* call it */ if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* pop result */ *size = 0; return NULL; }