updated for version 7.0185
diff --git a/src/syntax.c b/src/syntax.c
index 1c093a0..ab9bcce 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2974,8 +2974,11 @@
     else
     {
 	/* 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));
+	 * is a matchgroup. Watch out for match with last NL in the buffer. */
+	if (result->lnum > syn_buf->b_ml.ml_line_count)
+	    len = 0;
+	else
+	    len = STRLEN(ml_get_buf(syn_buf, result->lnum, FALSE));
 	if (col > len)
 	    result->col = len;
 	else