aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-11-17 14:46:44 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-11-17 14:46:44 -0200
commit2d5931ebc8c3136bae92b5c502f3de0f06c31364 (patch)
tree6640a98867596324ea625abea8c739bccf5864c3
parent35fa276099bba69c4def7304e53a8962b3ab00fc (diff)
downloadlua-2d5931ebc8c3136bae92b5c502f3de0f06c31364.tar.gz
lua-2d5931ebc8c3136bae92b5c502f3de0f06c31364.tar.bz2
lua-2d5931ebc8c3136bae92b5c502f3de0f06c31364.zip
ensure that reader function cannot yield during parsing
-rw-r--r--ldo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ldo.c b/ldo.c
index 9193cb0e..72c92e21 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 2.70 2009/10/23 19:12:19 roberto Exp roberto $ 2** $Id: ldo.c,v 2.71 2009/11/17 16:33:38 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -589,12 +589,14 @@ static void f_parser (lua_State *L, void *ud) {
589int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { 589int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) {
590 struct SParser p; 590 struct SParser p;
591 int status; 591 int status;
592 L->nny++; /* cannot yield during parsing */
592 p.z = z; p.name = name; 593 p.z = z; p.name = name;
593 p.varl.actvar = NULL; p.varl.nactvar = p.varl.actvarsize = 0; 594 p.varl.actvar = NULL; p.varl.nactvar = p.varl.actvarsize = 0;
594 luaZ_initbuffer(L, &p.buff); 595 luaZ_initbuffer(L, &p.buff);
595 status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); 596 status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc);
596 luaZ_freebuffer(L, &p.buff); 597 luaZ_freebuffer(L, &p.buff);
597 luaM_freearray(L, p.varl.actvar, p.varl.actvarsize); 598 luaM_freearray(L, p.varl.actvar, p.varl.actvarsize);
599 L->nny--;
598 return status; 600 return status;
599} 601}
600 602