1
0
forked from aniani/vim

patch 8.0.0879: crash when shifting with huge number

Problem:    Crash when shifting with huge number.
Solution:   Check for overflow. (Dominique Pelle, closes #1945)
This commit is contained in:
Bram Moolenaar
2017-08-06 15:42:06 +02:00
parent cae92dc3d5
commit bae5a17a73
3 changed files with 14 additions and 1 deletions

View File

@@ -396,7 +396,10 @@ shift_block(oparg_T *oap, int amount)
return;
/* total is number of screen columns to be inserted/removed */
total = amount * p_sw;
total = (int)((unsigned)amount * (unsigned)p_sw);
if ((total / p_sw) != amount)
return; /* multiplication overflow */
oldp = ml_get_curline();
if (!left)