diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/pattern.c | 22 |
2 files changed, 17 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog index d05a624d2..1f386c05e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-05-28 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 44361: Src/pattern.c: Ensure variables used recursively are + initialised in pattern matching. + 2019-05-28 Peter Stephenson <p.stephenson@samsung.com> * Jim Murphy: 44364: Doc/Zsh/intro.yo: refer to main zsh page in diff --git a/Src/pattern.c b/Src/pattern.c index 737f5cdcb..97d488a31 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -2030,6 +2030,16 @@ int errsfound; /* Total error count so far */ /**/ int forceerrs; /* Forced maximum error count */ +/* + * exactpos is used to remember how far down an exact string we have + * matched, if we are doing approximation and can therefore redo from + * the same point; we never need to otherwise. + * + * exactend is a pointer to the end of the string, which isn't + * null-terminated. + */ +static char *exactpos, *exactend; + /**/ void pattrystart(void) @@ -2463,6 +2473,8 @@ pattryrefs(Patprog prog, char *string, int stringlen, int unmetalenin, patinput = patinstart; + exactpos = exactend = NULL; + /* The only external call to patmatch --- all others are recursive */ if (patmatch((Upat)progstr)) { /* * we were lazy and didn't save the globflags if an exclusion @@ -2653,16 +2665,6 @@ patmatchlen(void) (charmatch_cache = (expr), CHARMATCH(charmatch_cache, chpa)) /* - * exactpos is used to remember how far down an exact string we have - * matched, if we are doing approximation and can therefore redo from - * the same point; we never need to otherwise. - * - * exactend is a pointer to the end of the string, which isn't - * null-terminated. - */ -static char *exactpos, *exactend; - -/* * Main matching routine. * * Testing the tail end of a match is usually done by recursion, but |