To: vim_dev@googlegroups.com Subject: Patch 8.2.3403 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3403 (after 8.2.3402) Problem: Memory leak for :retab with invalid argument. Solution: Free the memory. Make error messages consistent. Files: src/indent.c *** ../vim-8.2.3402/src/indent.c 2021-09-04 18:47:25.184668070 +0200 --- src/indent.c 2021-09-04 21:19:06.192166335 +0200 *************** *** 70,78 **** --- 70,81 ---- { int n = atoi((char *)cp); + // Catch negative values, overflow and ridiculous big values. if (n < 0 || n > 9999) { semsg(_(e_invarg2), cp); + vim_free(*array); + *array = NULL; return FAIL; } (*array)[t++] = n; *************** *** 1615,1626 **** else new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str); #else ! new_ts = getdigits(&(eap->arg)); ! if (new_ts < 0) { emsg(_(e_positive)); return; } if (new_ts == 0) new_ts = curbuf->b_p_ts; #endif --- 1618,1635 ---- else new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str); #else ! ptr = eap->arg; ! new_ts = getdigits(&ptr); ! if (new_ts < 0 && *eap->arg == '-') { emsg(_(e_positive)); return; } + if (new_ts < 0 || new_ts > 9999) + { + semsg(_(e_invarg2), eap->arg); + return; + } if (new_ts == 0) new_ts = curbuf->b_p_ts; #endif *** ../vim-8.2.3402/src/version.c 2021-09-04 18:47:25.184668070 +0200 --- src/version.c 2021-09-04 21:20:17.471944536 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3403, /**/ -- An alien life briefly visits earth. Just before departing it leaves a message in the dust on the back of a white van. The world is shocked and wants to know what it means. After months of studies the worlds best linguistic scientists are able to decipher the message: "Wash me!". /// 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 ///