diff --git a/plugins/luamacro/_globalinfo.lua b/plugins/luamacro/_globalinfo.lua index f9fc150dba..27fca4fcca 100644 --- a/plugins/luamacro/_globalinfo.lua +++ b/plugins/luamacro/_globalinfo.lua @@ -1,6 +1,6 @@ function export.GetGlobalInfo() return { - Version = { 3, 0, 0, 857 }, + Version = { 3, 0, 0, 858 }, MinFarVersion = { 3, 0, 0, 6380 }, Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"), Title = "LuaMacro", diff --git a/plugins/luamacro/changelog b/plugins/luamacro/changelog index 5dee2fa779..1829200d71 100644 --- a/plugins/luamacro/changelog +++ b/plugins/luamacro/changelog @@ -1,3 +1,8 @@ +shmuel 2024-11-07 19:43:26+02:00 - build 858 + +1. LuaFAR: prevent a certain kind of crashes + E.g. lua:far.Timer(1000, function() error {} end) + shmuel 2024-11-06 23:51:17+02:00 - build 857 1. LuaFAR: change win.JoinPath a little (see the manual) diff --git a/plugins/luamacro/luafar/exported.c b/plugins/luamacro/luafar/exported.c index e7441efbf4..156607ac8a 100644 --- a/plugins/luamacro/luafar/exported.c +++ b/plugins/luamacro/luafar/exported.c @@ -110,10 +110,12 @@ int pcall_msg(lua_State* L, int narg, int nret) status2 = lua_pcall(L,1,0,0); } - if (status2 != 0) - { - LF_Error(L, check_utf8_string(L, -1, NULL)); - lua_pop(L, 1); + if (status2 != 0) { + if (lua_isstring(L, -1)) // this check prevents crashes + LF_Error (L, check_utf8_string(L, -1, NULL)); + else + LF_Error (L, L"error object is not a string"); + lua_pop (L, 1); } *Flags &= ~PDF_PROCESSINGERROR; diff --git a/plugins/luamacro/luafar/version.h b/plugins/luamacro/luafar/version.h index b75158e788..1dd4864a84 100644 --- a/plugins/luamacro/luafar/version.h +++ b/plugins/luamacro/luafar/version.h @@ -1,3 +1,3 @@ #include -#define PLUGIN_BUILD 857 +#define PLUGIN_BUILD 858