fix(context): don't crash on invalid arg to nvim_get_context (#25977)

Note: The crash happens in the second test case when using uninitialized
memory, and therefore doesn't happen with ASAN.
This commit is contained in:
zeertzjq
2023-11-11 10:21:14 +08:00
committed by GitHub
parent d1b2a5cf5f
commit e9b9a86cd5
7 changed files with 45 additions and 18 deletions

View File

@@ -261,7 +261,9 @@ Object vim_to_object(typval_T *obj)
/// @param obj Object to convert from.
/// @param tv Conversion result is placed here. On failure member v_type is
/// set to VAR_UNKNOWN (no allocation was made for this variable).
/// returns true if conversion is successful, otherwise false.
/// @param err Error object.
///
/// @returns true if conversion is successful, otherwise false.
bool object_to_vim(Object obj, typval_T *tv, Error *err)
{
tv->v_type = VAR_UNKNOWN;