diff options
author | LW <git@llllvvuu.dev> | 2023-11-03 15:56:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-04 06:56:45 +0800 |
commit | 468292dcb743c79714b030557cf2754b7b5bf07d (patch) | |
tree | aa7b9a309c68222b0e8d1af2f7fb90c07024df2f /test/unit/helpers.lua | |
parent | 9ad239690fe6b151afe2f43c2858d68a2b877e1d (diff) | |
download | rneovim-468292dcb743c79714b030557cf2754b7b5bf07d.tar.gz rneovim-468292dcb743c79714b030557cf2754b7b5bf07d.tar.bz2 rneovim-468292dcb743c79714b030557cf2754b7b5bf07d.zip |
fix(rpc): "grid_line" event parsing crashes (#25581)
refactor: use a more idiomatic loop to iterate over the cells
There are two cases in which the following assertion would fail:
```c
assert(g->icell < g->ncells);
```
1. If `g->ncells = 0`. Update this to be legal.
2. If an EOF is reached while parsing `wrap`. In this case, the unpacker
attempts to resume from `cells`, which is a bug. Create a new state
for parsing `wrap`.
Reference: https://neovim.io/doc/user/ui.html#ui-event-grid_line
Diffstat (limited to 'test/unit/helpers.lua')
-rw-r--r-- | test/unit/helpers.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua index 448209fe0b..8d581dac49 100644 --- a/test/unit/helpers.lua +++ b/test/unit/helpers.lua @@ -861,6 +861,7 @@ local function is_asan() end end +--- @class test.unit.helpers.module local module = { cimport = cimport, cppimport = cppimport, @@ -890,7 +891,9 @@ local module = { debug_log = debug_log, is_asan = is_asan, } +--- @class test.unit.helpers: test.unit.helpers.module, test.helpers module = global_helpers.tbl_extend('error', module, global_helpers) + return function() return module end |