mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 19:25:11 -07:00
parent
33eaa171fa
commit
b6b270b28f
@ -2804,8 +2804,8 @@ win_line (
|
||||
off += col;
|
||||
}
|
||||
|
||||
// wont highlight after 1024 columns
|
||||
int term_attrs[1024] = {0};
|
||||
// wont highlight after TERM_ATTRS_MAX columns
|
||||
int term_attrs[TERM_ATTRS_MAX] = { 0 };
|
||||
if (wp->w_buffer->terminal) {
|
||||
terminal_get_line_attributes(wp->w_buffer->terminal, wp, lnum, term_attrs);
|
||||
extra_check = true;
|
||||
@ -4172,7 +4172,7 @@ win_line (
|
||||
int n = wp->w_p_rl ? -1 : 1;
|
||||
while (col >= 0 && col < grid->Columns) {
|
||||
schar_from_ascii(linebuf_char[off], ' ');
|
||||
linebuf_attr[off] = term_attrs[vcol];
|
||||
linebuf_attr[off] = vcol >= TERM_ATTRS_MAX ? 0 : term_attrs[vcol];
|
||||
off += n;
|
||||
vcol += n;
|
||||
col += n;
|
||||
|
@ -32,6 +32,9 @@ EXTERN ScreenGrid default_grid INIT(= SCREEN_GRID_INIT);
|
||||
|
||||
#define DEFAULT_GRID_HANDLE 1 // handle for the default_grid
|
||||
|
||||
// Maximum columns for terminal highlight attributes
|
||||
#define TERM_ATTRS_MAX 1024
|
||||
|
||||
/// Status line click definition
|
||||
typedef struct {
|
||||
enum {
|
||||
|
@ -607,6 +607,7 @@ void terminal_get_line_attributes(Terminal *term, win_T *wp, int linenr,
|
||||
return;
|
||||
}
|
||||
|
||||
width = MIN(TERM_ATTRS_MAX, width);
|
||||
for (int col = 0; col < width; col++) {
|
||||
VTermScreenCell cell;
|
||||
bool color_valid = fetch_cell(term, row, col, &cell);
|
||||
|
@ -276,3 +276,12 @@ describe('No heap-buffer-overflow when using', function()
|
||||
feed_command('bdelete!')
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('No heap-buffer-overflow when', function()
|
||||
it('set nowrap and send long line #11548', function()
|
||||
feed_command('set nowrap')
|
||||
feed_command('autocmd TermOpen * startinsert')
|
||||
feed_command('call feedkeys("4000ai\\<esc>:terminal!\\<cr>")')
|
||||
eq(2, eval('1+1'))
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user