forked from aniani/vim
patch 8.2.2181: valgrind warnings for using uninitialized value
Problem: Valgrind warnings for using uninitialized value. Solution: Do not use "start" or "end" unless there is a match.
This commit is contained in:
@@ -4805,8 +4805,10 @@ theend:
|
||||
if (backpos.ga_maxlen > BACKPOS_INITIAL)
|
||||
ga_clear(&backpos);
|
||||
|
||||
// Make sure the end is never before the start. Can happen when \zs and
|
||||
// \ze are used.
|
||||
if (retval > 0)
|
||||
{
|
||||
// Make sure the end is never before the start. Can happen when \zs
|
||||
// and \ze are used.
|
||||
if (REG_MULTI)
|
||||
{
|
||||
lpos_T *start = &rex.reg_mmatch->startpos[0];
|
||||
@@ -4821,6 +4823,7 @@ theend:
|
||||
if (rex.reg_match->endp[0] < rex.reg_match->startp[0])
|
||||
rex.reg_match->endp[0] = rex.reg_match->startp[0];
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -7227,6 +7227,8 @@ nfa_regexec_both(
|
||||
#endif
|
||||
|
||||
theend:
|
||||
if (retval > 0)
|
||||
{
|
||||
// Make sure the end is never before the start. Can happen when \zs and
|
||||
// \ze are used.
|
||||
if (REG_MULTI)
|
||||
@@ -7238,11 +7240,12 @@ theend:
|
||||
|| (end->lnum == start->lnum && end->col < start->col))
|
||||
rex.reg_mmatch->endpos[0] = rex.reg_mmatch->startpos[0];
|
||||
}
|
||||
else if (retval > 0)
|
||||
else
|
||||
{
|
||||
if (rex.reg_match->endp[0] < rex.reg_match->startp[0])
|
||||
rex.reg_match->endp[0] = rex.reg_match->startp[0];
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2181,
|
||||
/**/
|
||||
2180,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user