From 348fa1ca56efeb81ef66d8f09c3cd1405b0a121d Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 6 Dec 2017 16:20:28 -0200 Subject: bug: 'lua_pushcclosure' should not call the garbage collector when 'n' is zero. --- bugs | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/bugs b/bugs index f3caeec2..bd4b313c 100644 --- a/bugs +++ b/bugs @@ -3680,9 +3680,9 @@ It needs an "interceptor" 'memcmp' function that continues reading memory after a difference is found.]], patch = [[ 2c2 -< ** $Id: bugs,v 1.156 2017/08/12 13:12:42 roberto Exp roberto $ +< ** $Id: bugs,v 1.157 2017/08/31 16:14:41 roberto Exp roberto $ --- -> ** $Id: bugs,v 1.156 2017/08/12 13:12:42 roberto Exp roberto $ +> ** $Id: bugs,v 1.157 2017/08/31 16:14:41 roberto Exp roberto $ 263c263,264 < for (option = LUA_STRFTIMEOPTIONS; *option != '\0'; option += oplen) { --- @@ -3871,6 +3871,39 @@ patch = [[ } +Bug{ +what = [['lua_pushcclosure' should not call the garbage collector when +'n' is zero.]], +report = [[Andrew Gierth, 2017/12/05]], +since = [[5.3.3]], +fix = nil, +example = [[ ]], +patch = [[ +--- lapi.c 2017/04/19 17:13:00 2.259.1.1 ++++ lapi.c 2017/12/06 18:14:45 +@@ -533,6 +533,7 @@ + lua_lock(L); + if (n == 0) { + setfvalue(L->top, fn); ++ api_incr_top(L); + } + else { + CClosure *cl; +@@ -546,9 +547,9 @@ + /* does not need barrier because closure is white */ + } + setclCvalue(L, L->top, cl); ++ api_incr_top(L); ++ luaC_checkGC(L); + } +- api_incr_top(L); +- luaC_checkGC(L); + lua_unlock(L); + } +]] +} + + --[=[ -- cgit v1.2.3-55-g6feb