To: vim_dev@googlegroups.com Subject: Patch 8.2.3234 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3234 Problem: Crash when printing long string with Lua. Solution: Remove lua_pop(). (Martin Tournoij, closes #8648) Files: src/if_lua.c, src/testdir/test_lua.vim *** ../vim-8.2.3233/src/if_lua.c 2021-07-24 13:57:25.477296535 +0200 --- src/if_lua.c 2021-07-28 14:59:51.848578793 +0200 *************** *** 1734,1742 **** s = lua_tolstring(L, -1, &l); if (s == NULL) return luaL_error(L, "cannot convert to string"); ! if (i > 1) luaL_addchar(&b, ' '); // use space instead of tab luaV_addlstring(&b, s, l, 0); - lua_pop(L, 1); } luaL_pushresult(&b); if (!got_int) --- 1734,1742 ---- s = lua_tolstring(L, -1, &l); if (s == NULL) return luaL_error(L, "cannot convert to string"); ! if (i > 1) ! luaL_addchar(&b, ' '); // use space instead of tab luaV_addlstring(&b, s, l, 0); } luaL_pushresult(&b); if (!got_int) *** ../vim-8.2.3233/src/testdir/test_lua.vim 2021-04-07 20:11:07.987846226 +0200 --- src/testdir/test_lua.vim 2021-07-28 15:06:10.471507184 +0200 *************** *** 850,855 **** --- 850,873 ---- bwipe! endfunc + " Test :luafile printing a long string + func Test_luafile_print() + new Xlua_file + let lines =<< trim END + local data = '' + for i = 1, 130 do + data = data .. 'xxxxx asd as as dad sad sad xz cxz czxcxzczxc ad ad asd asd asd asd asd' + end + print(data) + END + call setline(1, lines) + w + luafile % + + call delete('Xlua_file') + bwipe! + endfunc + " Test for dealing with strings containing newlines and null character func Test_lua_string_with_newline() let x = execute('lua print("Hello\nWorld")') *** ../vim-8.2.3233/src/version.c 2021-07-28 13:30:12.212929910 +0200 --- src/version.c 2021-07-28 15:00:56.304386017 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3234, /**/ -- hundred-and-one symptoms of being an internet addict: 266. You hear most of your jokes via e-mail instead of in person. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///