forked from aniani/vim
patch 8.2.3492: crash when pasting too many times
Problem: Crash when pasting too many times. Solution: Limit the size to what fits in an int. (closes #8962)
This commit is contained in:
parent
6e77b88df6
commit
eeed1c7ae0
@ -664,3 +664,5 @@ EXTERN char e_blob_required_for_argument_nr[]
|
||||
INIT(= N_("E1238: Blob required for argument %d"));
|
||||
EXTERN char e_invalid_value_for_blob_nr[]
|
||||
INIT(= N_("E1239: Invalid value for blob: %d"));
|
||||
EXTERN char e_resulting_text_too_long[]
|
||||
INIT(= N_("E1240: Resulting text too long"));
|
||||
|
@ -2011,8 +2011,15 @@ do_put(
|
||||
}
|
||||
|
||||
do {
|
||||
totlen = count * yanklen;
|
||||
if (totlen > 0)
|
||||
long multlen = count * yanklen;
|
||||
|
||||
totlen = multlen;
|
||||
if (totlen != multlen)
|
||||
{
|
||||
emsg(_(e_resulting_text_too_long));
|
||||
break;
|
||||
}
|
||||
else if (totlen > 0)
|
||||
{
|
||||
oldp = ml_get(lnum);
|
||||
if (lnum > start_lnum)
|
||||
|
@ -134,4 +134,12 @@ func Test_gp_with_count_leaves_cursor_at_end()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_very_larg_count()
|
||||
new
|
||||
let @" = 'x'
|
||||
call assert_fails('norm 44444444444444p', 'E1240:')
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
@ -757,6 +757,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
3492,
|
||||
/**/
|
||||
3491,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user