mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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.
This commit is contained in:
@@ -7784,9 +7784,10 @@ reg_submatch(int no)
|
|||||||
if (lnum < 0 || rsm.sm_mmatch->endpos[no].lnum < 0)
|
if (lnum < 0 || rsm.sm_mmatch->endpos[no].lnum < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
s = reg_getline_submatch(lnum) + rsm.sm_mmatch->startpos[no].col;
|
s = reg_getline_submatch(lnum);
|
||||||
if (s == NULL) /* anti-crash check, cannot happen? */
|
if (s == NULL) // anti-crash check, cannot happen?
|
||||||
break;
|
break;
|
||||||
|
s += rsm.sm_mmatch->startpos[no].col;
|
||||||
if (rsm.sm_mmatch->endpos[no].lnum == lnum)
|
if (rsm.sm_mmatch->endpos[no].lnum == lnum)
|
||||||
{
|
{
|
||||||
/* Within one line: take form start to end col. */
|
/* Within one line: take form start to end col. */
|
||||||
|
@@ -779,6 +779,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1025,
|
||||||
/**/
|
/**/
|
||||||
1024,
|
1024,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user