patch 9.2.0337: list indexing broken on big-endian 32-bit platforms
Commit:
https://github.com/vim/vim/commit/8fd37e42a65a36c7e0ea65f73095fa9da89e15e2
Author: James McCoy <[email protected]>
Date: Sat Apr 11 15:00:50 2026 +0000
patch 9.2.0337: list indexing broken on big-endian 32-bit platforms
Problem: check_range_index_one() expects a long * but n1 is a
varnumber_T. Casting varnumber_T * to long * is undefined
behaviour and reads the wrong bytes on big-endian platforms
(John Paul Adrian Glaubitz)
Solution: Use a local long variable and pass that pointer to
check_range_index_one() (James McCoy)
fixes: #19798
closes: #19952
Signed-off-by: James McCoy <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/list.c b/src/list.c
index c9e9d686b..3074bb93f 100644
--- a/src/list.c
+++ b/src/list.c
@@ -1368,7 +1368,8 @@ list_slice_or_index(
{
// copy the item to "var1" to avoid that freeing the list makes it
// invalid.
- listitem_T *li = check_range_index_one(list, (long *)&n1, TRUE, TRUE);
+ long index = n1;
+ listitem_T *li = check_range_index_one(list, &index, TRUE, TRUE);
if (li == NULL)
return FAIL;
copy_tv(&li->li_tv, &var1);
diff --git a/src/version.c b/src/version.c
index 0b3a06d20..f4e5ef7ec 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 337,
/**/
336,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1wBa35-00F2Sr-7W%40256bit.org.