To: vim_dev@googlegroups.com Subject: Patch 8.1.1603 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1603 Problem: Crash when using unknown highlighting in text property. Solution: Check for zero highlight ID. Files: src/screen.c, src/testdir/test_textprop.vim *** ../vim-8.1.1602/src/screen.c 2019-06-26 03:39:59.897650758 +0200 --- src/screen.c 2019-06-28 21:36:56.486643152 +0200 *************** *** 3171,3177 **** int row; /* row in the window, excl w_winrow */ int screen_row; /* row on the screen, incl w_winrow */ ! char_u extra[18]; /* "%ld" and 'fdc' must fit in here */ int n_extra = 0; /* number of extra chars */ char_u *p_extra = NULL; /* string of extra chars, plus NUL */ char_u *p_extra_free = NULL; /* p_extra needs to be freed */ --- 3171,3177 ---- int row; /* row in the window, excl w_winrow */ int screen_row; /* row on the screen, incl w_winrow */ ! char_u extra[20]; /* "%ld" and 'fdc' must fit in here */ int n_extra = 0; /* number of extra chars */ char_u *p_extra = NULL; /* string of extra chars, plus NUL */ char_u *p_extra_free = NULL; /* p_extra needs to be freed */ *************** *** 4440,4446 **** proptype_T *pt = text_prop_type_by_id( wp->w_buffer, text_props[tpi].tp_type); ! if (pt != NULL) { int pt_attr = syn_id2attr(pt->pt_hl_id); --- 4440,4446 ---- proptype_T *pt = text_prop_type_by_id( wp->w_buffer, text_props[tpi].tp_type); ! if (pt != NULL && pt->pt_hl_id > 0) { int pt_attr = syn_id2attr(pt->pt_hl_id); *** ../vim-8.1.1602/src/testdir/test_textprop.vim 2019-06-19 18:15:43.880526461 +0200 --- src/testdir/test_textprop.vim 2019-06-28 21:34:47.035263474 +0200 *************** *** 792,797 **** --- 792,808 ---- call prop_type_delete('comment') 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 func Test_textprop_empty_buffer_next() call prop_type_add("xxx", {}) *** ../vim-8.1.1602/src/version.c 2019-06-28 04:06:47.052007794 +0200 --- src/version.c 2019-06-28 21:37:36.590451948 +0200 *************** *** 779,780 **** --- 779,782 ---- { /* Add new patch number below this line */ + /**/ + 1603, /**/ -- Facepalm statement #1: "I'm going to New York tomorrow, hopefully I have time to visit the White House" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///