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
This commit is contained in:
LW
2023-11-03 15:56:45 -07:00
committed by GitHub
parent 9ad239690f
commit 468292dcb7
4 changed files with 133 additions and 54 deletions

View File

@@ -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