summaryrefslogtreecommitdiff
path: root/src/ops.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-06 15:42:06 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-06 15:42:06 +0200
commitbae5a17a738d1a3b5c51d9aa5d99e228d3911955 (patch)
tree8e5eade690175963af3c749a4c368acf3b346164 /src/ops.c
parentcae92dc3d5bdd4009910671328cd01394bfbe2cf (diff)
downloadvim-git-bae5a17a738d1a3b5c51d9aa5d99e228d3911955.tar.gz
patch 8.0.0879: crash when shifting with huge numberv8.0.0879
Problem: Crash when shifting with huge number. Solution: Check for overflow. (Dominique Pelle, closes #1945)
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ops.c b/src/ops.c
index 0f42dea00..5c58e523f 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -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)