patch 9.1.1406: crash when importing invalid tuple

Problem:  crash when importing invalid tuple
          (Yang LUO, Yanju Chen)
Solution: set type to VAR_UNKNOWN, so that it isn't freed
          (Yegappan Lakshmanan)

closes: #17362

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2025-05-23 17:39:44 +02:00
committed by Christian Brabandt
parent 9ff1e598e8
commit 9772025d24
3 changed files with 16 additions and 0 deletions

View File

@ -518,6 +518,9 @@ eval_tuple(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error)
// Add the first item to the tuple from "rettv"
if (tuple_append_tv(tuple, rettv) == FAIL)
return FAIL;
// The first item in "rettv" is added to the tuple. Set the rettv
// type to unknown, so that the caller doesn't free it.
rettv->v_type = VAR_UNKNOWN;
}
}