]> granicus.if.org Git - vim/commitdiff
patch 8.1.1025: checking NULL pointer after addition v8.1.1025
authorBram Moolenaar <Bram@vim.org>
Wed, 20 Mar 2019 20:18:34 +0000 (21:18 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 20 Mar 2019 20:18:34 +0000 (21:18 +0100)
Problem:    Checking NULL pointer after addition. (Coverity)
Solution:   First check for NULL, then add the column.

src/regexp.c
src/version.c

index 4b853172e569ed02d8bfc926822aa08df286ffc2..5557987d5862066fd10b0095ec0bebd5b35afc4f 100644 (file)
@@ -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. */
index 2515a25156e32e39cc7b58ab75dc5438fb1a2db8..e7f3bf3f81d9a8b866dd908f1834de804d682d08 100644 (file)
@@ -779,6 +779,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1025,
 /**/
     1024,
 /**/