mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
parent
1de33ce2cd
commit
b2cef8b665
@ -2692,8 +2692,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;
|
||||
@ -4030,7 +4030,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 {
|
||||
|
@ -588,6 +588,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);
|
||||
|
@ -264,3 +264,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