changeset 26394:43d196ca5e7a v8.2.3728

patch 8.2.3728: internal error when passing range() to list2blob() Commit: https://github.com/vim/vim/commit/04b7b4bf7fe57375bf3c4ed3fd087fc0bb0147ba Author: kuuote <znmxodq1@gmail.com> Date: Fri Dec 3 13:57:00 2021 +0000 patch 8.2.3728: internal error when passing range() to list2blob() Problem: Internal error when passing range() to list2blob(). Solution: Materialize the list first. (closes https://github.com/vim/vim/issues/9262)
author Bram Moolenaar <Bram@vim.org>
date Fri, 03 Dec 2021 15:00:05 +0100
parents 070e77657c21
children fe4bc08c1e0b
files src/blob.c src/testdir/test_blob.vim src/version.c
diffstat 3 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/blob.c
+++ b/src/blob.c
@@ -526,6 +526,7 @@ f_list2blob(typval_T *argvars, typval_T 
     if (l == NULL)
 	return;
 
+    CHECK_LIST_MATERIALIZE(l);
     FOR_ALL_LIST_ITEMS(l, li)
     {
 	int		error;
--- a/src/testdir/test_blob.vim
+++ b/src/testdir/test_blob.vim
@@ -675,7 +675,10 @@ func Test_list2blob()
   let b = range(16)->repeat(64)->list2blob()
   call assert_equal(1024, b->len())
   call assert_equal([4, 8, 15], [b[100], b[1000], b[1023]])
+
   call assert_equal(0z, list2blob(test_null_list()))
+  call assert_equal(0z00010203, list2blob(range(4)))
 endfunc
 
+
 " vim: shiftwidth=2 sts=2 expandtab
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3728,
+/**/
     3727,
 /**/
     3726,