To: vim_dev@googlegroups.com Subject: Patch 8.2.3291 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3291 Problem: Coverity warns for not checking return value. Solution: If dict_add() fails give an error message. Files: src/if_lua.c, src/testdir/test_lua.vim *** ../vim-8.2.3290/src/if_lua.c 2021-08-04 21:12:48.783060069 +0200 --- src/if_lua.c 2021-08-05 15:09:05.313681419 +0200 *************** *** 1862,1868 **** return 0; // Update the value copy_tv(&tv, &di->di_tv); ! dict_add(dict, di); } else { // Clear the old value --- 1862,1869 ---- return 0; // Update the value copy_tv(&tv, &di->di_tv); ! if (dict_add(dict, di) == FAIL) ! return luaL_error(L, "Couldn't add to dictionary"); } else { // Clear the old value *** ../vim-8.2.3290/src/testdir/test_lua.vim 2021-08-04 21:12:48.783060069 +0200 --- src/testdir/test_lua.vim 2021-08-05 15:10:06.413549523 +0200 *************** *** 1009,1014 **** --- 1009,1018 ---- call assert_fails('lua vim.g.Var2[3] = 21', 'list is locked') unlockvar g:Var2 + let g:TestFunc = function('len') + call assert_fails('lua vim.g.func = vim.g.TestFunc', ['E704:', 'Couldn''t add to dictionary']) + unlet g:TestFunc + " Attempt to access a non-existing global variable call assert_equal(v:null, luaeval('vim.g.NonExistingVar')) lua vim.g.NonExisting = Nil *** ../vim-8.2.3290/src/version.c 2021-08-04 22:30:46.856467289 +0200 --- src/version.c 2021-08-05 15:03:34.170370143 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3291, /**/ -- I still remember when I gave up Smoking, Drinking and Sex. It was the most *horrifying* hour of my life! /// Bram Moolenaar -- Bram@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 ///