Skip to content

Commit

Permalink
LuaFAR: prevent a certain kind of crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed Nov 7, 2024
1 parent ed58568 commit 1ac034e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plugins/luamacro/_globalinfo.lua
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 5 additions & 0 deletions plugins/luamacro/changelog
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
10 changes: 6 additions & 4 deletions plugins/luamacro/luafar/exported.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/luafar/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <farversion.hpp>

#define PLUGIN_BUILD 857
#define PLUGIN_BUILD 858

0 comments on commit 1ac034e

Please sign in to comment.