xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit 22713f5f5399b67e303544b41cd5c636381d4e9d

Fix a crash on non-string in VifmView:loadcustom()
The non-string-like value should be in the "paths" field to trigger the
crash.
Author: xaizek
Author date (UTC): 2026-01-12 22:16
Committer name: xaizek
Committer date (UTC): 2026-01-13 15:29
Parent(s): 2d706360d813f9ae89e723194527ed507b6b4244
Signing key: 99DC5E4DB05F6BE2
Tree: 4e3f4abb47ab5b6f373a9febf862244f1e939b27
File Lines added Lines deleted
ChangeLog.LuaAPI 3 0
data/vim/doc/app/vifm-lua.txt 3 3
src/lua/vifmview.c 4 1
tests/lua/api_view.c 9 0
File ChangeLog.LuaAPI changed (mode: 100644) (index aff6a8ca6..464fc45de)
... ... documented in the regular ChangeLog.
9 9
10 10 Upgraded Lua from 5.4.7 to 5.4.8. Upgraded Lua from 5.4.7 to 5.4.8.
11 11
12 Fixed a crash on passing a value that's not convertible to a string to
13 VifmView:loadcustom().
14
12 15 0.13 to 0.14-beta (2025-01-19) 0.13 to 0.14-beta (2025-01-19)
13 16
14 17 Bumped API version to v0.2.0. Bumped API version to v0.2.0.
File data/vim/doc/app/vifm-lua.txt changed (mode: 100644) (index 19d12f613..e6c365ebd)
1 *vifm-lua.txt* For Vifm version 1.0 Last change: 2025 Mar 22
1 *vifm-lua.txt* For Vifm version 1.0 Last change: 2026 Jan 13
2 2
3 3 Email for bugs and suggestions: <xaizek@posteo.net> Email for bugs and suggestions: <xaizek@posteo.net>
4 4
 
... ... Possible fields of {info}:
1593 1593 - "title" (string) - "title" (string)
1594 1594 Title of the view. Title of the view.
1595 1595 - "paths" (array of strings) - "paths" (array of strings)
1596 List of paths. Can be empty. Paths that don't correspond to an existing
1597 file or duplicates are ignored.
1596 List of paths. Can be empty. Items that don't correspond to an existing
1597 file, cannot be converted to a string or duplicates are ignored.
1598 1598 - "type" (string) (default: "custom") - "type" (string) (default: "custom")
1599 1599 What kind of custom view to create: What kind of custom view to create:
1600 1600 - "custom" - "custom"
File src/lua/vifmview.c changed (mode: 100644) (index e29bd2d07..f07e5fd75)
... ... VLUA_API(vifmview_loadcustom)(lua_State *lua)
583 583 while(lua_next(lua, -2) != 0) while(lua_next(lua, -2) != 0)
584 584 { {
585 585 const char *path = lua_tostring(lua, -1); const char *path = lua_tostring(lua, -1);
586 (void)flist_custom_add(view, path);
586 if(path != NULL)
587 {
588 (void)flist_custom_add(view, path);
589 }
587 590 lua_pop(lua, 1); lua_pop(lua, 1);
588 591 } }
589 592
File tests/lua/api_view.c changed (mode: 100644) (index 3a89893b7..ec6c8a857)
... ... TEST(vifmview_loadcustom)
426 426 assert_string_equal("a", lwin.dir_entry[0].name); assert_string_equal("a", lwin.dir_entry[0].name);
427 427 assert_string_equal("aa", lwin.dir_entry[1].name); assert_string_equal("aa", lwin.dir_entry[1].name);
428 428
429 /* Invalid type is filtered out. */
430 GLUA_ENDS(vlua, "",
431 "print(vifm.currview():loadcustom({ title = 'title',"
432 "paths = { 'a', {} } }))");
433 assert_true(flist_custom_active(&lwin));
434 assert_int_equal(CV_REGULAR, lwin.custom.type);
435 assert_int_equal(1, lwin.list_rows);
436 assert_string_equal("a", lwin.dir_entry[0].name);
437
429 438 /* Good invocation for unsorted view. */ /* Good invocation for unsorted view. */
430 439 GLUA_ENDS(vlua, "", GLUA_ENDS(vlua, "",
431 440 "print(vifm.currview():loadcustom({ title = 'title'," "print(vifm.currview():loadcustom({ title = 'title',"
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master