mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3234: crash when printing long string with Lua
Problem: Crash when printing long string with Lua. Solution: Remove lua_pop(). (Martin Tournoij, closes #8648)
This commit is contained in:
parent
e2390c7f32
commit
78e006b9b0
@ -1734,9 +1734,9 @@ luaV_print(lua_State *L)
|
|||||||
s = lua_tolstring(L, -1, &l);
|
s = lua_tolstring(L, -1, &l);
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return luaL_error(L, "cannot convert to string");
|
return luaL_error(L, "cannot convert to string");
|
||||||
if (i > 1) luaL_addchar(&b, ' '); // use space instead of tab
|
if (i > 1)
|
||||||
|
luaL_addchar(&b, ' '); // use space instead of tab
|
||||||
luaV_addlstring(&b, s, l, 0);
|
luaV_addlstring(&b, s, l, 0);
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
}
|
||||||
luaL_pushresult(&b);
|
luaL_pushresult(&b);
|
||||||
if (!got_int)
|
if (!got_int)
|
||||||
|
@ -850,6 +850,24 @@ func Test_luafile_error()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
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
|
" Test for dealing with strings containing newlines and null character
|
||||||
func Test_lua_string_with_newline()
|
func Test_lua_string_with_newline()
|
||||||
let x = execute('lua print("Hello\nWorld")')
|
let x = execute('lua print("Hello\nWorld")')
|
||||||
|
@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3234,
|
||||||
/**/
|
/**/
|
||||||
3233,
|
3233,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user