summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-02-26 14:00:07 +0100
committerBram Moolenaar <Bram@vim.org>2017-02-26 14:00:07 +0100
commitba748c8a847561c043a63827bcb1d98bdebe16e6 (patch)
tree9c5660b52127b6e85fc48ea5187700f28ad31d4b /src/ex_cmds.c
parent376407674ff10b60e7c6090906be50982763f0f3 (diff)
patch 8.0.0374: invalid memory access when using :sc in Ex modev8.0.0374
Problem: Invalid memory access when using :sc in Ex mode. (Dominique Pelle) Solution: Avoid the column being negative. Also fix a hang in Ex mode.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 5b118e564c..c38687d740 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -5288,6 +5288,8 @@ do_sub(exarg_T *eap)
getvcol(curwin, &curwin->w_cursor, &sc, NULL, NULL);
curwin->w_cursor.col = regmatch.endpos[0].col - 1;
+ if (curwin->w_cursor.col < 0)
+ curwin->w_cursor.col = 0;
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &ec);
if (subflags.do_number || curwin->w_p_nu)
{