aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 4fb1a1ea9d..d0317c84f6 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -312,7 +312,6 @@ static void shift_block(oparg_T *oap, int amount)
{
int left = (oap->op_type == OP_LSHIFT);
int oldstate = State;
- int total;
char_u *newp, *oldp;
int oldcol = curwin->w_cursor.col;
int p_sw = get_sw_value(curbuf);
@@ -331,8 +330,12 @@ static void shift_block(oparg_T *oap, int amount)
if (bd.is_short)
return;
- /* total is number of screen columns to be inserted/removed */
- total = amount * p_sw;
+ // total is number of screen columns to be inserted/removed
+ int total = (int)((unsigned)amount * (unsigned)p_sw);
+ if ((total / p_sw) != amount) {
+ return; // multiplication overflow
+ }
+
oldp = get_cursor_line_ptr();
if (!left) {