diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2012-04-27 11:13:19 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2012-04-27 11:13:19 -0300 |
commit | fc24a3a6c40b573f1a89cf89b92d16a25519cc36 (patch) | |
tree | b4917f559d29777dc34678b301f04b42f64468fd /lbaselib.c | |
parent | a94ce68e0aa9cd11dece30528d8dbd0354db1798 (diff) | |
download | lua-fc24a3a6c40b573f1a89cf89b92d16a25519cc36.tar.gz lua-fc24a3a6c40b573f1a89cf89b92d16a25519cc36.tar.bz2 lua-fc24a3a6c40b573f1a89cf89b92d16a25519cc36.zip |
small bug: a reader function should not modify the Lua stack
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.272 2011/11/30 12:42:21 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.273 2011/11/30 13:03:24 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -293,6 +293,7 @@ static const char *generic_reader (lua_State *L, void *ud, size_t *size) { | |||
293 | lua_pushvalue(L, 1); /* get function */ | 293 | lua_pushvalue(L, 1); /* get function */ |
294 | lua_call(L, 0, 1); /* call it */ | 294 | lua_call(L, 0, 1); /* call it */ |
295 | if (lua_isnil(L, -1)) { | 295 | if (lua_isnil(L, -1)) { |
296 | lua_pop(L, 1); /* pop result */ | ||
296 | *size = 0; | 297 | *size = 0; |
297 | return NULL; | 298 | return NULL; |
298 | } | 299 | } |