mirror of
https://github.com/vim/vim.git
synced 2025-08-23 19:34:27 -04:00
patch 8.1.1603: crash when using unknown highlighting in text property
Problem: Crash when using unknown highlighting in text property. Solution: Check for zero highlight ID.
This commit is contained in:
parent
711d02c96d
commit
d74af4227b
@ -3171,7 +3171,7 @@ win_line(
|
|||||||
int row; /* row in the window, excl w_winrow */
|
int row; /* row in the window, excl w_winrow */
|
||||||
int screen_row; /* row on the screen, incl w_winrow */
|
int screen_row; /* row on the screen, incl w_winrow */
|
||||||
|
|
||||||
char_u extra[18]; /* "%ld" and 'fdc' must fit in here */
|
char_u extra[20]; /* "%ld" and 'fdc' must fit in here */
|
||||||
int n_extra = 0; /* number of extra chars */
|
int n_extra = 0; /* number of extra chars */
|
||||||
char_u *p_extra = NULL; /* string of extra chars, plus NUL */
|
char_u *p_extra = NULL; /* string of extra chars, plus NUL */
|
||||||
char_u *p_extra_free = NULL; /* p_extra needs to be freed */
|
char_u *p_extra_free = NULL; /* p_extra needs to be freed */
|
||||||
@ -4440,7 +4440,7 @@ win_line(
|
|||||||
proptype_T *pt = text_prop_type_by_id(
|
proptype_T *pt = text_prop_type_by_id(
|
||||||
wp->w_buffer, text_props[tpi].tp_type);
|
wp->w_buffer, text_props[tpi].tp_type);
|
||||||
|
|
||||||
if (pt != NULL)
|
if (pt != NULL && pt->pt_hl_id > 0)
|
||||||
{
|
{
|
||||||
int pt_attr = syn_id2attr(pt->pt_hl_id);
|
int pt_attr = syn_id2attr(pt->pt_hl_id);
|
||||||
|
|
||||||
|
@ -792,6 +792,17 @@ func Test_textprop_empty_buffer()
|
|||||||
call prop_type_delete('comment')
|
call prop_type_delete('comment')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Adding a text property with invalid highlight should be ignored.
|
||||||
|
func Test_textprop_invalid_highlight()
|
||||||
|
call assert_fails("call prop_type_add('dni', {'highlight': 'DoesNotExist'})", 'E970:')
|
||||||
|
new
|
||||||
|
call setline(1, ['asdf','asdf'])
|
||||||
|
call prop_add(1, 1, {'length': 4, 'type': 'dni'})
|
||||||
|
redraw
|
||||||
|
bwipe!
|
||||||
|
call prop_type_delete('dni')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Adding a text property to an empty buffer and then editing another
|
" Adding a text property to an empty buffer and then editing another
|
||||||
func Test_textprop_empty_buffer_next()
|
func Test_textprop_empty_buffer_next()
|
||||||
call prop_type_add("xxx", {})
|
call prop_type_add("xxx", {})
|
||||||
|
@ -777,6 +777,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1603,
|
||||||
/**/
|
/**/
|
||||||
1602,
|
1602,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user