changeset 16040:13ab270dd68d v8.1.1025

patch 8.1.1025: checking NULL pointer after addition commit https://github.com/vim/vim/commit/64c8ed366de995a01ca1a072a6943ede0d7bb932 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 20 21:18:34 2019 +0100 patch 8.1.1025: checking NULL pointer after addition Problem: Checking NULL pointer after addition. (Coverity) Solution: First check for NULL, then add the column.
author Bram Moolenaar <Bram@vim.org>
date Wed, 20 Mar 2019 21:30:04 +0100
parents 64a87f94518e
children d9834cd3a8b8
files src/regexp.c src/version.c
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -7784,9 +7784,10 @@ reg_submatch(int no)
 	    if (lnum < 0 || rsm.sm_mmatch->endpos[no].lnum < 0)
 		return NULL;
 
-	    s = reg_getline_submatch(lnum) + rsm.sm_mmatch->startpos[no].col;
-	    if (s == NULL)  /* anti-crash check, cannot happen? */
+	    s = reg_getline_submatch(lnum);
+	    if (s == NULL)  // anti-crash check, cannot happen?
 		break;
+	    s += rsm.sm_mmatch->startpos[no].col;
 	    if (rsm.sm_mmatch->endpos[no].lnum == lnum)
 	    {
 		/* Within one line: take form start to end col. */
--- a/src/version.c
+++ b/src/version.c
@@ -780,6 +780,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1025,
+/**/
     1024,
 /**/
     1023,