updated for version 7.0180
diff --git a/src/syntax.c b/src/syntax.c
index 01a476e..1c093a0 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2956,6 +2956,7 @@
     int		extra;		/* extra chars for offset to start */
 {
     int		col;
+    int		len;
 
     if (spp->sp_off_flags & (1 << idx))
     {
@@ -2971,7 +2972,15 @@
     if (col < 0)
 	result->col = 0;
     else
-	result->col = col;
+    {
+	/* Don't go past the end of the line.  Matters for "rs=e+2" when there
+	 * is a matchgroup. */
+	len = STRLEN(ml_get_buf(syn_buf, result->lnum, FALSE));
+	if (col > len)
+	    result->col = len;
+	else
+	    result->col = col;
+    }
 }
 
 /*