From: Christian Brabandt Date: Wed, 21 May 2025 19:01:40 +0000 (+0200) Subject: patch 9.1.1401: list not materialized in prop_list() X-Git-Tag: v9.1.1401^0 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56b1207e66d8db82dabf3f36aadf24caea61aa71;p=thirdparty%2Fvim.git patch 9.1.1401: list not materialized in prop_list() Problem: list not materialized in prop_list() (Nickwiz) Solution: materialize list before accessing it fixes: #17298 closes: #17349 Signed-off-by: Christian Brabandt --- diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index d26efa9489..bcf83cab8f 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -4757,4 +4757,29 @@ func Test_textprop_with_wincolor() call StopVimInTerminal(buf) endfunc +func Test_textprop_materialize_list() + let ids = range(3) + call assert_equal([], prop_list(1, #{ids: ids})) + + let ids = range(3) + [] + call assert_equal([], prop_list(1, #{ids: ids})) + + let ids = range(3) + let ids[0] = ids[0] + call assert_equal([], prop_list(1, #{ids: ids})) + + let ids = range(3) + call assert_equal([], prop_list(1, #{ids: ids})) + + call assert_equal([], prop_list(1, #{ids: range(3) + [] })) + + let ids = range(3) + call assert_equal([], prop_list(1, #{ids: ids})) + + let ids = range(0, 3) + call assert_equal([], prop_list(1, #{ids: ids})) + + call assert_equal([], prop_list(1, #{ids: 3->range()})) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/textprop.c b/src/textprop.c index d16f8ecef3..a06605d3dd 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1439,7 +1439,7 @@ get_prop_ids_from_list(list_T *l, int *num_ids) { int *prop_ids; listitem_T *li; - int i; + int i = 0; int id; int error; @@ -1449,7 +1449,7 @@ get_prop_ids_from_list(list_T *l, int *num_ids) if (prop_ids == NULL) return NULL; - i = 0; + CHECK_LIST_MATERIALIZE(l); FOR_ALL_LIST_ITEMS(l, li) { error = FALSE; diff --git a/src/version.c b/src/version.c index a6c749dc05..252c1437bf 100644 --- a/src/version.c +++ b/src/version.c @@ -709,6 +709,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1401, /**/ 1400, /**/