From 2d5931ebc8c3136bae92b5c502f3de0f06c31364 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 17 Nov 2009 14:46:44 -0200 Subject: [PATCH] ensure that reader function cannot yield during parsing --- ldo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ldo.c b/ldo.c index 9193cb0e..72c92e21 100644 --- a/ldo.c +++ b/ldo.c @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 2.70 2009/10/23 19:12:19 roberto Exp roberto $ +** $Id: ldo.c,v 2.71 2009/11/17 16:33:38 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -589,12 +589,14 @@ static void f_parser (lua_State *L, void *ud) { int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { struct SParser p; int status; + L->nny++; /* cannot yield during parsing */ p.z = z; p.name = name; p.varl.actvar = NULL; p.varl.nactvar = p.varl.actvarsize = 0; luaZ_initbuffer(L, &p.buff); status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); luaZ_freebuffer(L, &p.buff); luaM_freearray(L, p.varl.actvar, p.varl.actvarsize); + L->nny--; return status; }