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 <jamessan@jamessan.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
{
// 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);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 337,
/**/
336,
/**/