Files
neovim/scripts
Justin M. Keyes 06ac562766 fix(eval): leaks and Lua stack misuse on failed conversion #42643
Problem:
- `json_encode()` leaks the conversion stack if a dict key nested more
  than 8 levels deep is invalid UTF-8, and leaks the string of an
  invalid special string (`v:msgpack_types.string`).
- Lua conversion passes the total stack size to `lua_checkstack()`,
  which expects the extra slots, so it fails at half the real limit.
- If `nlua_push_typval()` fails, the Lua stack is not restored: e.g.
  `vim.g.x` returns part of the half-built value.

Solution:
- `encode_vim_to_*()` owns the conversion state, so converter macros
  may return at any point.
- Check the Lua stack once per value, for 3 extra slots.
- Restore the Lua stack and push nil on failure.
2026-11-01 20:31:29 -05:00
..
2025-11-18 12:35:22 -08:00