mirror of
https://github.com/vim/vim.git
synced 2025-08-25 19:53:53 -04:00
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:
parent
9ff1e598e8
commit
9772025d24
@ -1586,6 +1586,17 @@ func Test_recursive_tuple_eval_fails()
|
|||||||
\ 'E121: Undefined variable: pat'])
|
\ 'E121: Undefined variable: pat'])
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" The following used to crash Vim
|
||||||
|
func Test_import_invalid_tuple()
|
||||||
|
let lines =<< trim END
|
||||||
|
imp(",G0}11*f[+\x","#|
|
||||||
|
END
|
||||||
|
new
|
||||||
|
call setline(1, lines)
|
||||||
|
call assert_fails('source', 'E114: Missing double quote: "#|')
|
||||||
|
bw!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test for add() with a tuple
|
" Test for add() with a tuple
|
||||||
func Test_tuple_add()
|
func Test_tuple_add()
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
|
@ -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"
|
// Add the first item to the tuple from "rettv"
|
||||||
if (tuple_append_tv(tuple, rettv) == FAIL)
|
if (tuple_append_tv(tuple, rettv) == FAIL)
|
||||||
return 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,6 +709,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1406,
|
||||||
/**/
|
/**/
|
||||||
1405,
|
1405,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user