diff --git a/ChangeLog b/ChangeLog index 7a1f0fb..82144ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -210,6 +210,9 @@ erroneous error "\ at end of pattern". errors or other strange effects if compiled in UCP mode. Found with libFuzzer and AddressSanitizer. +61. Whitespace at the end of a pcre2test pattern line caused a spurious error +message if there were only single-character modifiers. It should be ignored. + Version 10.20 30-June-2015 -------------------------- diff --git a/src/pcre2test.c b/src/pcre2test.c index 88c61eb..d13f719 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -3111,7 +3111,11 @@ for (;;) /* Find the end of the item; lose trailing whitespace at end of line. */ for (ep = p; *ep != 0 && *ep != ','; ep++); - if (*ep == 0) while (ep > p && isspace(ep[-1])) ep--; + if (*ep == 0) + { + while (ep > p && isspace(ep[-1])) ep--; + *ep = 0; + } /* Remember if the first character is '-'. */