Patch 8.2.2422
Problem: Crash when deleting with line number out of range. (Houyunsong)
Solution: Avoid using a negative line number.
Files: src/normal.c, src/testdir/test_ex_mode.vim
*** ../vim-8.2.2421/src/normal.c 2021-01-21 17:03:04.475217089 +0100
--- src/normal.c 2021-01-28 17:23:19.966217892 +0100
***************
*** 630,636 ****
}
else
ca.count0 = ca.count0 * 10 + (c - '0');
! if (ca.count0 < 0) // got too large!
ca.count0 = 999999999L;
#ifdef FEAT_EVAL
// Set v:count here, when called from main() and not a stuffed
--- 630,636 ----
}
else
ca.count0 = ca.count0 * 10 + (c - '0');
! if (ca.count0 < 0) // overflow
ca.count0 = 999999999L;
#ifdef FEAT_EVAL
// Set v:count here, when called from main() and not a stuffed
***************
*** 701,706 ****
--- 701,708 ----
ca.count0 *= ca.opcount;
else
ca.count0 = ca.opcount;
+ if (ca.count0 < 0) // overflow
+ ca.count0 = 999999999L;
}
/*
***************
*** 4775,4780 ****
--- 4777,4784 ----
else
curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count *
cap->count0 + 99L) / 100L;
+ if (curwin->w_cursor.lnum < 1)
+ curwin->w_cursor.lnum = 1;
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
beginline(BL_SOL | BL_FIX);
*** ../vim-8.2.2421/src/testdir/test_ex_mode.vim 2020-11-23
18:14:51.272875917 +0100
--- src/testdir/test_ex_mode.vim 2021-01-28 17:24:27.761919848 +0100
***************
*** 206,209 ****
--- 206,225 ----
call delete('Xexmodescript')
endfunc
+ func Test_ex_mode_count_overflow()
+ " this used to cause a crash
+ let lines =<< trim END
+ call feedkeys("\<Esc>Q\<CR>")
+ v9|9silent! vi|333333233333y32333333%O
+ call writefile(['done'], 'Xdidexmode')
+ qall!
+ END
+ call writefile(lines, 'Xexmodescript')
+ call assert_equal(1, RunVim([], [], '-e -s -S Xexmodescript -c qa'))
+ call assert_equal(['done'], readfile('Xdidexmode'))
+
+ call delete('Xdidexmode')
+ call delete('Xexmodescript')
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2421/src/version.c 2021-01-28 14:24:51.181688004 +0100
--- src/version.c 2021-01-28 17:23:43.858112670 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2422,
/**/
--
Place mark here ->[ ]<- if you want a dirty monitor.
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202101281625.10SGPiZ1105783%40masaka.moolenaar.net.