To: vim_dev@googlegroups.com Subject: Patch 8.1.1938 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1938 Problem: May crash when out of memory. Solution: Initialize v_type to VAR_UNKNOWN. (Dominique Pelle, closes #4871) Files: src/userfunc.c *** ../vim-8.1.1937/src/userfunc.c 2019-08-21 14:36:29.395376065 +0200 --- src/userfunc.c 2019-08-29 21:30:22.668793186 +0200 *************** *** 1501,1506 **** --- 1501,1510 ---- int argv_base = 0; partial_T *partial = funcexe->partial; + // Initialize rettv so that it is safe for caller to invoke clear_tv(rettv) + // even when call_func() returns FAIL. + rettv->v_type = VAR_UNKNOWN; + // Make a copy of the name, if it comes from a funcref variable it could // be changed or deleted in the called function. name = len > 0 ? vim_strnsave(funcname, len) : vim_strsave(funcname); *************** *** 1530,1545 **** } } ! /* ! * Execute the function if executing and no errors were detected. ! */ ! if (!funcexe->evaluate) ! { ! // Not evaluating, which means the return value is unknown. This ! // matters for giving error messages. ! rettv->v_type = VAR_UNKNOWN; ! } ! else if (error == ERROR_NONE) { char_u *rfname = fname; --- 1534,1540 ---- } } ! if (error == ERROR_NONE && funcexe->evaluate) { char_u *rfname = fname; *** ../vim-8.1.1937/src/version.c 2019-08-29 21:24:17.494449998 +0200 --- src/version.c 2019-08-29 21:32:37.516161622 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1938, /**/ -- hundred-and-one symptoms of being an internet addict: 132. You come back and check this list every half-hour. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///