Patch 8.2.4976

3 views
Skip to first unread message

Bram Moolenaar

unread,
May 18, 2022, 6:01:29 AM5/18/22
to vim...@googlegroups.com

Patch 8.2.4976
Problem: Coverity complains about not restoring a saved value.
Solution: Restore value before handling error.
Files: src/vim9execute.c


*** ../vim-8.2.4975/src/vim9execute.c 2022-05-17 16:12:35.708086414 +0100
--- src/vim9execute.c 2022-05-18 10:58:16.791577825 +0100
***************
*** 4653,4668 ****
{
checktype_T *ct = &iptr->isn_arg.type;
int save_wt_variable = ectx->ec_where.wt_variable;

tv = STACK_TV_BOT((int)ct->ct_off);
SOURCING_LNUM = iptr->isn_lnum;
if (!ectx->ec_where.wt_variable)
ectx->ec_where.wt_index = ct->ct_arg_idx;
ectx->ec_where.wt_variable = ct->ct_is_var;
! if (check_typval_type(ct->ct_type, tv, ectx->ec_where)
! == FAIL)
! goto on_error;
ectx->ec_where.wt_variable = save_wt_variable;
if (!ectx->ec_where.wt_variable)
ectx->ec_where.wt_index = 0;

--- 4653,4669 ----
{
checktype_T *ct = &iptr->isn_arg.type;
int save_wt_variable = ectx->ec_where.wt_variable;
+ int r;

tv = STACK_TV_BOT((int)ct->ct_off);
SOURCING_LNUM = iptr->isn_lnum;
if (!ectx->ec_where.wt_variable)
ectx->ec_where.wt_index = ct->ct_arg_idx;
ectx->ec_where.wt_variable = ct->ct_is_var;
! r = check_typval_type(ct->ct_type, tv, ectx->ec_where);
ectx->ec_where.wt_variable = save_wt_variable;
+ if (r == FAIL)
+ goto on_error;
if (!ectx->ec_where.wt_variable)
ectx->ec_where.wt_index = 0;

*** ../vim-8.2.4975/src/version.c 2022-05-17 20:10:58.744361606 +0100
--- src/version.c 2022-05-18 10:59:56.583539649 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4976,
/**/

--
hundred-and-one symptoms of being an internet addict:
225. You sign up for free subscriptions for all the computer magazines

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages