From de9f7b6a97b421f512e15582eca990ca4592f787 Mon Sep 17 00:00:00 2001 From: Shmuel Zeigerman Date: Wed, 18 Mar 2015 18:53:32 +0000 Subject: [PATCH] =?UTF-8?q?LuaFAR=20(=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE?= =?UTF-8?q?=D1=82=D0=B5=D0=BA=D0=B0=20regex):=20=D0=BF=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B8=20=D0=B1=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D1=88=D0=BE=D0=BC=20=D0=BA=D0=BE=D0=BB=D0=B8=D1=87=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=B2=D0=B5=20captures=20(=D0=BD=D0=B5=D1=81=D0=BA?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=B4=D0=B5=D1=81=D1=8F=D1=82?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2)=20=D0=B8=D0=B7-=D0=B7=D0=B0=20=D0=BE=D1=82?= =?UTF-8?q?=D1=81=D1=83=D1=82=D1=81=D1=82=D0=B2=D0=BE=D0=B2=D0=B0=D0=B2?= =?UTF-8?q?=D1=88=D0=B5=D0=B3=D0=BE=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=20lua=5Fcheckstack.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/luamacro/_globalinfo.lua | 2 +- plugins/luamacro/changelog | 7 ++++++- plugins/luamacro/luafar/lregex.c | 3 +++ plugins/luamacro/luamacro.rc | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/luamacro/_globalinfo.lua b/plugins/luamacro/_globalinfo.lua index d69c0afead..0cbb09b3d3 100644 --- a/plugins/luamacro/_globalinfo.lua +++ b/plugins/luamacro/_globalinfo.lua @@ -1,6 +1,6 @@ function export.GetGlobalInfo() return { - Version = { 1, 0, 0, 493 }, + Version = { 1, 0, 0, 494 }, MinFarVersion = { 3, 0, 0, 4276 }, Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"), Title = "LuaMacro", diff --git a/plugins/luamacro/changelog b/plugins/luamacro/changelog index 80a97618b3..cdab6d2eb9 100644 --- a/plugins/luamacro/changelog +++ b/plugins/luamacro/changelog @@ -1,4 +1,9 @@ -shmuel 17.03.2015 17:57:24 +0200 - build 493 +shmuel 18.03.2015 20:34:15 +0200 - build 494 + +1. LuaFAR (библиотека regex): падение при большом количестве captures (несколько десятков) из-за + отсутствовавшего вызова lua_checkstack. + +shmuel 17.03.2015 17:57:24 +0200 - build 493 1. С форума: Запуск lua: mf.postmacro(eval,"F1") приводит к ошибке "bad argument #1 to 'getfenv' (invalid level)". diff --git a/plugins/luamacro/luafar/lregex.c b/plugins/luamacro/luafar/lregex.c index f1da83c592..8e5012fa5f 100644 --- a/plugins/luamacro/luafar/lregex.c +++ b/plugins/luamacro/luafar/lregex.c @@ -194,6 +194,9 @@ int rx_find_match(lua_State *L, int op_find, int is_function, int is_wide) skip = (op_find || data.Count>1) ? 1 : 0; + if (!lua_checkstack(L, (int)data.Count - skip)) + luaL_error(L, "cannot add %d stack slots", (int)data.Count - skip); + for(i=skip; i= 0 && data.Match[i].end >= data.Match[i].start) diff --git a/plugins/luamacro/luamacro.rc b/plugins/luamacro/luamacro.rc index c6e896424e..3050b1501e 100644 --- a/plugins/luamacro/luamacro.rc +++ b/plugins/luamacro/luamacro.rc @@ -1,6 +1,6 @@ #include -#define PLUGIN_BUILD 493 +#define PLUGIN_BUILD 494 #define PLUGIN_DESC "Lua Macros for Far Manager" #define PLUGIN_NAME "LuaMacro" #define PLUGIN_FILENAME "luamacro.dll"